From 019b3322e79b5e549bf12222aa4964c43dae3154 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Tue, 16 May 2023 12:22:00 +0300 Subject: [PATCH 01/17] chore: add enum to handle different reqwest errors & add timeout to requests --- src/engines/duckduckgo.rs | 3 ++- src/engines/engine_models.rs | 8 ++++++++ src/engines/mod.rs | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/engines/engine_models.rs diff --git a/src/engines/duckduckgo.rs b/src/engines/duckduckgo.rs index 254ab16..7232165 100644 --- a/src/engines/duckduckgo.rs +++ b/src/engines/duckduckgo.rs @@ -2,7 +2,7 @@ //! by querying the upstream duckduckgo search engine with user provided query and with a page //! number if provided. -use std::collections::HashMap; +use std::{collections::HashMap, time::Duration}; use reqwest::header::{HeaderMap, CONTENT_TYPE, COOKIE, REFERER, USER_AGENT}; use scraper::{Html, Selector}; @@ -57,6 +57,7 @@ pub async fn results( // TODO: Write better error handling code to handle no results case. let results: String = reqwest::Client::new() .get(url) + .timeout(Duration::from_secs(30)) .headers(header_map) // add spoofed headers to emulate human behaviour .send() .await? diff --git a/src/engines/engine_models.rs b/src/engines/engine_models.rs new file mode 100644 index 0000000..7dc8ad6 --- /dev/null +++ b/src/engines/engine_models.rs @@ -0,0 +1,8 @@ +#[derive(Debug)] +pub enum ReqwestError{ + NotFound, + Timeout, + Forbidden, + AccessDenied, + TooManyRequests +} diff --git a/src/engines/mod.rs b/src/engines/mod.rs index 7f390b1..f9bb8ad 100644 --- a/src/engines/mod.rs +++ b/src/engines/mod.rs @@ -1,2 +1,3 @@ pub mod duckduckgo; +pub mod engine_models; pub mod searx; From 6556e0fdad13db4fd30950a5fca9da2a9ba43839 Mon Sep 17 00:00:00 2001 From: LX5321 Date: Fri, 26 May 2023 13:08:17 +0530 Subject: [PATCH 02/17] UPDATED: Removed Deprecated API --- public/static/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/static/index.js b/public/static/index.js index 1261e15..ad52ab9 100644 --- a/public/static/index.js +++ b/public/static/index.js @@ -4,7 +4,7 @@ function search_web() { } search_box.addEventListener('keyup', (e) => { - if (e.keyCode === 13) { + if (e.key === 'Enter') { search_web() } }) From 5962cca294df604d093f9e82ab7ab5c52e73ad37 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Wed, 31 May 2023 19:54:51 +0300 Subject: [PATCH 03/17] chore: provide a better and more standardized way to handle engine errors --- src/engines/duckduckgo.rs | 19 +++++++--- src/engines/engine_models.rs | 70 ++++++++++++++++++++++++++++++++---- src/engines/searx.rs | 23 +++++++++--- 3 files changed, 96 insertions(+), 16 deletions(-) diff --git a/src/engines/duckduckgo.rs b/src/engines/duckduckgo.rs index 7232165..219801a 100644 --- a/src/engines/duckduckgo.rs +++ b/src/engines/duckduckgo.rs @@ -9,6 +9,8 @@ use scraper::{Html, Selector}; use crate::search_results_handler::aggregation_models::RawSearchResult; +use super::engine_models::EngineErrorKind; + /// This function scrapes results from the upstream engine duckduckgo and puts all the scraped /// results like title, visiting_url (href in html),engine (from which engine it was fetched from) /// and description in a RawSearchResult and then adds that to HashMap whose keys are url and @@ -22,14 +24,15 @@ use crate::search_results_handler::aggregation_models::RawSearchResult; /// /// # Errors /// -/// Returns a reqwest error if the user is not connected to the internet or if their is failure to -/// reach the above `upstream search engine` page and also returns error if the scraping -/// selector fails to initialize" +/// Returns an `EngineErrorKind` if the user is not connected to the internet or if their is failure to +/// reach the above `upstream search engine` page or if the `upstream search engine` is unable to +/// provide results for the requested search query and also returns error if the scraping selector +/// or HeaderMap fails to initialize. pub async fn results( query: &str, page: u32, user_agent: &str, -) -> Result, Box> { +) -> Result, EngineErrorKind> { // Page number can be missing or empty string and so appropriate handling is required // so that upstream server recieves valid page number. let url: String = match page { @@ -54,7 +57,6 @@ pub async fn results( header_map.insert(COOKIE, "kl=wt-wt".parse()?); // fetch the html from upstream duckduckgo engine - // TODO: Write better error handling code to handle no results case. let results: String = reqwest::Client::new() .get(url) .timeout(Duration::from_secs(30)) @@ -65,6 +67,13 @@ pub async fn results( .await?; let document: Html = Html::parse_document(&results); + + let no_result: Selector = Selector::parse(".no-results")?; + + if let Some(_) = document.select(&no_result).next() { + return Err(EngineErrorKind::EmptyResultSet); + } + let results: Selector = Selector::parse(".result")?; let result_title: Selector = Selector::parse(".result__a")?; let result_url: Selector = Selector::parse(".result__url")?; diff --git a/src/engines/engine_models.rs b/src/engines/engine_models.rs index 7dc8ad6..16cc266 100644 --- a/src/engines/engine_models.rs +++ b/src/engines/engine_models.rs @@ -1,8 +1,66 @@ +//! This module provides the error enum to handle different errors associated while requesting data from +//! the upstream search engines with the search query provided by the user. + +use reqwest::header::InvalidHeaderValue; +use scraper::error::SelectorErrorKind; + +/// A custom error type used for handle engine associated errors. +/// +/// This enum provides variants three different categories of errors: +/// * `RequestError` - This variant handles all request related errors like forbidden, not found, +/// etc. +/// * `EmptyResultSet` - This variant handles the not results found error provide by the upstream +/// search engines. +/// * `UnexpectedError` - This variant handles all the errors which are unexpected or occur rarely +/// and are errors mostly related to failure in initialization of HeaderMap, Selector errors and +/// all other errors. #[derive(Debug)] -pub enum ReqwestError{ - NotFound, - Timeout, - Forbidden, - AccessDenied, - TooManyRequests +pub enum EngineErrorKind { + RequestError(reqwest::Error), + EmptyResultSet, + UnexpectedError(String), +} + +/// Implementing `Display` trait to make errors writable on the stdout and also providing/passing the +/// appropriate errors that should be written to the stdout when this error is raised/encountered. +impl std::fmt::Display for EngineErrorKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + EngineErrorKind::RequestError(request_error) => write!(f, "{}", request_error), + EngineErrorKind::EmptyResultSet => { + write!(f, "The upstream search engine returned an empty result set") + } + EngineErrorKind::UnexpectedError(unexpected_error) => write!(f, "{}", unexpected_error), + } + } +} + +/// Implementing `Error` trait to make the the `EngineErrorKind` enum an error type. +impl std::error::Error for EngineErrorKind {} + +/// Implementing `From` trait to map the `SelectorErrorKind` to `UnexpectedError` variant. +impl<'a> From> for EngineErrorKind { + fn from(err: SelectorErrorKind<'a>) -> Self { + match err { + _ => Self::UnexpectedError(err.to_string()), + } + } +} + +/// Implementing `From` trait to map the `InvalidHeaderValue` to `UnexpectedError` variant. +impl<'a> From for EngineErrorKind { + fn from(err: InvalidHeaderValue) -> Self { + match err { + _ => Self::UnexpectedError(err.to_string()), + } + } +} + +/// Implementing `From` trait to map all `reqwest::Error` to `UnexpectedError` variant. +impl<'a> From for EngineErrorKind { + fn from(err: reqwest::Error) -> Self { + match err { + _ => Self::RequestError(err), + } + } } diff --git a/src/engines/searx.rs b/src/engines/searx.rs index 8812dd9..feab464 100644 --- a/src/engines/searx.rs +++ b/src/engines/searx.rs @@ -8,6 +8,8 @@ use std::collections::HashMap; use crate::search_results_handler::aggregation_models::RawSearchResult; +use super::engine_models::EngineErrorKind; + /// This function scrapes results from the upstream engine duckduckgo and puts all the scraped /// results like title, visiting_url (href in html),engine (from which engine it was fetched from) /// and description in a RawSearchResult and then adds that to HashMap whose keys are url and @@ -21,14 +23,15 @@ use crate::search_results_handler::aggregation_models::RawSearchResult; /// /// # Errors /// -/// Returns a reqwest error if the user is not connected to the internet or if their is failure to -/// reach the above `upstream search engine` page and also returns error if the scraping -/// selector fails to initialize" +/// Returns an `EngineErrorKind` if the user is not connected to the internet or if their is failure to +/// reach the above `upstream search engine` page or if the `upstream search engine` is unable to +/// provide results for the requested search query and also returns error if the scraping selector +/// or HeaderMap fails to initialize. pub async fn results( query: &str, page: u32, user_agent: &str, -) -> Result, Box> { +) -> Result, EngineErrorKind> { // Page number can be missing or empty string and so appropriate handling is required // so that upstream server recieves valid page number. let url: String = format!("https://searx.work/search?q={query}&pageno={page}"); @@ -41,7 +44,6 @@ pub async fn results( header_map.insert(COOKIE, "categories=general; language=auto; locale=en; autocomplete=duckduckgo; image_proxy=1; method=POST; safesearch=2; theme=simple; results_on_new_tab=1; doi_resolver=oadoi.org; simple_style=auto; center_alignment=1; query_in_title=1; infinite_scroll=0; disabled_engines=; enabled_engines=\"archive is__general\\054yep__general\\054curlie__general\\054currency__general\\054ddg definitions__general\\054wikidata__general\\054duckduckgo__general\\054tineye__general\\054lingva__general\\054startpage__general\\054yahoo__general\\054wiby__general\\054marginalia__general\\054alexandria__general\\054wikibooks__general\\054wikiquote__general\\054wikisource__general\\054wikiversity__general\\054wikivoyage__general\\054dictzone__general\\054seznam__general\\054mojeek__general\\054naver__general\\054wikimini__general\\054brave__general\\054petalsearch__general\\054goo__general\"; disabled_plugins=; enabled_plugins=\"searx.plugins.hostname_replace\\054searx.plugins.oa_doi_rewrite\\054searx.plugins.vim_hotkeys\"; tokens=; maintab=on; enginetab=on".parse()?); // fetch the html from upstream searx instance engine - // TODO: Write better error handling code to handle no results case. let results: String = reqwest::Client::new() .get(url) .headers(header_map) // add spoofed headers to emulate human behaviours. @@ -51,6 +53,17 @@ pub async fn results( .await?; let document: Html = Html::parse_document(&results); + + let no_result: Selector = Selector::parse("#urls>.dialog-error>p")?; + + if let Some(no_result_msg) = document.select(&no_result).nth(1) { + if no_result_msg.inner_html() + == "we didn't find any results. Please use another query or search in more categories" + { + return Err(EngineErrorKind::EmptyResultSet); + } + } + let results: Selector = Selector::parse(".result")?; let result_title: Selector = Selector::parse("h3>a")?; let result_url: Selector = Selector::parse("h3>a")?; From 5b4a6a82829312abdb5c177c0a227cd65f15772a Mon Sep 17 00:00:00 2001 From: neon_arch Date: Wed, 31 May 2023 20:14:26 +0300 Subject: [PATCH 04/17] chore: bump version to v0.12.0 --- Cargo.lock | 277 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 138 insertions(+), 141 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85310e9..ccc0f05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,19 +4,19 @@ version = 3 [[package]] name = "actix-codec" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a7559404a7f3573127aab53c08ce37a6c6a315c374a31070f3c91cd1b4a7fe" +checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8" dependencies = [ "bitflags", "bytes 1.4.0", "futures-core", "futures-sink", - "log", "memchr", "pin-project-lite", - "tokio 1.28.0", + "tokio 1.28.2", "tokio-util", + "tracing", ] [[package]] @@ -53,7 +53,7 @@ dependencies = [ "actix-service", "actix-utils", "ahash 0.8.3", - "base64 0.21.0", + "base64 0.21.2", "bitflags", "brotli", "bytes 1.4.0", @@ -62,7 +62,7 @@ dependencies = [ "encoding_rs", "flate2", "futures-core", - "h2 0.3.18", + "h2 0.3.19", "http 0.2.9", "httparse", "httpdate", @@ -75,7 +75,7 @@ dependencies = [ "rand 0.8.5", "sha1", "smallvec 1.10.0", - "tokio 1.28.0", + "tokio 1.28.2", "tokio-util", "tracing", "zstd", @@ -87,7 +87,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" dependencies = [ - "quote 1.0.27", + "quote 1.0.28", "syn 1.0.109", ] @@ -111,7 +111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15265b6b8e2347670eb363c47fc8c75208b4a4994b27192f345fcbe707804f3e" dependencies = [ "futures-core", - "tokio 1.28.0", + "tokio 1.28.2", ] [[package]] @@ -125,10 +125,10 @@ dependencies = [ "actix-utils", "futures-core", "futures-util", - "mio 0.8.6", + "mio 0.8.8", "num_cpus", "socket2", - "tokio 1.28.0", + "tokio 1.28.2", "tracing", ] @@ -201,8 +201,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2262160a7ae29e3415554a3f1fc04c764b1540c116aa524683208078b7a75bc9" dependencies = [ "actix-router", - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "syn 1.0.109", ] @@ -315,9 +315,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "bit-set" @@ -381,9 +381,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.1" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byteorder" @@ -605,8 +605,8 @@ dependencies = [ "itoa 1.0.6", "matches", "phf 0.10.1", - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "smallvec 1.10.0", "syn 1.0.109", ] @@ -617,7 +617,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" dependencies = [ - "quote 1.0.27", + "quote 1.0.28", "syn 1.0.109", ] @@ -628,17 +628,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "rustc_version 0.4.0", "syn 1.0.109", ] [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", @@ -730,8 +730,8 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "syn 1.0.109", "synstructure", ] @@ -959,9 +959,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" +checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" dependencies = [ "bytes 1.4.0", "fnv", @@ -971,16 +971,16 @@ dependencies = [ "http 0.2.9", "indexmap", "slab", - "tokio 1.28.0", + "tokio 1.28.2", "tokio-util", "tracing", ] [[package]] name = "handlebars" -version = "4.3.6" +version = "4.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "035ef95d03713f2c347a72547b7cd38cbc9af7cd51e6099fb62d586d4a6dee3a" +checksum = "83c3372087601b532857d332f5957cbae686da52bb7810bf038c3e3c3cc2fa0d" dependencies = [ "log", "pest", @@ -1035,8 +1035,8 @@ dependencies = [ "log", "mac", "markup5ever 0.11.0", - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "syn 1.0.109", ] @@ -1149,7 +1149,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.18", + "h2 0.3.19", "http 0.2.9", "http-body 0.4.5", "httparse", @@ -1157,7 +1157,7 @@ dependencies = [ "itoa 1.0.6", "pin-project-lite", "socket2", - "tokio 1.28.0", + "tokio 1.28.2", "tower-service", "tracing", "want 0.3.0", @@ -1185,7 +1185,7 @@ dependencies = [ "bytes 1.4.0", "hyper 0.14.26", "native-tls", - "tokio 1.28.0", + "tokio 1.28.2", "tokio-native-tls", ] @@ -1242,9 +1242,9 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", @@ -1301,9 +1301,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.62" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c16e1bfd491478ab155fd8b4896b86f9ede344949b641e61501e07c2b8b4d5" +checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" dependencies = [ "wasm-bindgen", ] @@ -1338,9 +1338,9 @@ checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" [[package]] name = "linux-raw-sys" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "local-channel" @@ -1381,12 +1381,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if 1.0.0", -] +checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" [[package]] name = "mac" @@ -1513,14 +1510,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1606,15 +1603,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" [[package]] name = "openssl" -version = "0.10.52" +version = "0.10.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" +checksum = "12df40a956736488b7b44fe79fe12d4f245bb5b3f5a1f6095e499760015be392" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1631,9 +1628,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.27", - "syn 2.0.15", + "proc-macro2 1.0.59", + "quote 1.0.28", + "syn 2.0.18", ] [[package]] @@ -1644,9 +1641,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.87" +version = "0.9.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" +checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617" dependencies = [ "cc", "libc", @@ -1749,9 +1746,9 @@ checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.56", - "quote 1.0.27", - "syn 2.0.15", + "proc-macro2 1.0.59", + "quote 1.0.28", + "syn 2.0.18", ] [[package]] @@ -1863,8 +1860,8 @@ dependencies = [ "phf_generator 0.10.0", "phf_shared 0.10.0", "proc-macro-hack", - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "syn 1.0.109", ] @@ -1942,9 +1939,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" dependencies = [ "unicode-ident", ] @@ -1970,11 +1967,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ - "proc-macro2 1.0.56", + "proc-macro2 1.0.59", ] [[package]] @@ -2213,9 +2210,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" dependencies = [ "aho-corasick", "memchr", @@ -2224,9 +2221,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "reqwest" @@ -2264,16 +2261,16 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.17" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", "bytes 1.4.0", "encoding_rs", "futures-core", "futures-util", - "h2 0.3.18", + "h2 0.3.19", "http 0.2.9", "http-body 0.4.5", "hyper 0.14.26", @@ -2289,7 +2286,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded 0.7.1", - "tokio 1.28.0", + "tokio 1.28.2", "tokio-native-tls", "tower-service", "url 2.3.1", @@ -2410,9 +2407,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.8.2" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ "bitflags", "core-foundation", @@ -2423,9 +2420,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" dependencies = [ "core-foundation-sys", "libc", @@ -2482,22 +2479,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.162" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" +checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.162" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" +checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.27", - "syn 2.0.15", + "proc-macro2 1.0.59", + "quote 1.0.28", + "syn 2.0.18", ] [[package]] @@ -2680,8 +2677,8 @@ checksum = "f0f45ed1b65bf9a4bf2f7b7dc59212d1926e9eaf00fa998988e420fd124467c6" dependencies = [ "phf_generator 0.7.24", "phf_shared 0.7.24", - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "string_cache_shared", ] @@ -2693,8 +2690,8 @@ checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ "phf_generator 0.10.0", "phf_shared 0.10.0", - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", ] [[package]] @@ -2720,19 +2717,19 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.15" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "unicode-ident", ] @@ -2742,8 +2739,8 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.27", + "proc-macro2 1.0.59", + "quote 1.0.28", "syn 1.0.109", "unicode-xid 0.2.4", ] @@ -2796,9 +2793,9 @@ version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.27", - "syn 2.0.15", + "proc-macro2 1.0.59", + "quote 1.0.28", + "syn 2.0.18", ] [[package]] @@ -2875,14 +2872,14 @@ dependencies = [ [[package]] name = "tokio" -version = "1.28.0" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ "autocfg 1.1.0", "bytes 1.4.0", "libc", - "mio 0.8.6", + "mio 0.8.8", "num_cpus", "parking_lot 0.12.1", "pin-project-lite", @@ -2940,9 +2937,9 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.27", - "syn 2.0.15", + "proc-macro2 1.0.59", + "quote 1.0.28", + "syn 2.0.18", ] [[package]] @@ -2952,7 +2949,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", - "tokio 1.28.0", + "tokio 1.28.2", ] [[package]] @@ -3037,7 +3034,7 @@ dependencies = [ "futures-core", "futures-sink", "pin-project-lite", - "tokio 1.28.0", + "tokio 1.28.2", "tracing", ] @@ -3061,9 +3058,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", ] @@ -3112,9 +3109,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -3243,9 +3240,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.85" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b6cb788c4e39112fbe1822277ef6fb3c55cd86b95cb3d3c4c1c9597e4ac74b4" +checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3253,24 +3250,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.85" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e522ed4105a9d626d885b35d62501b30d9666283a5c8be12c14a8bdafe7822" +checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.56", - "quote 1.0.27", - "syn 2.0.15", + "proc-macro2 1.0.59", + "quote 1.0.28", + "syn 2.0.18", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.35" +version = "0.4.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "083abe15c5d88556b77bdf7aef403625be9e327ad37c62c4e4129af740168163" +checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3280,38 +3277,38 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.85" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "358a79a0cb89d21db8120cbfb91392335913e4890665b1a7981d9e956903b434" +checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" dependencies = [ - "quote 1.0.27", + "quote 1.0.28", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.85" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4783ce29f09b9d93134d41297aded3a712b7b979e9c6f28c32cb88c973a94869" +checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.27", - "syn 2.0.15", + "proc-macro2 1.0.59", + "quote 1.0.28", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.85" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a901d592cafaa4d711bc324edfaff879ac700b19c3dfd60058d2b445be2691eb" +checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "web-sys" -version = "0.3.62" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b5f940c7edfdc6d12126d98c9ef4d1b3d470011c47c76a6581df47ad9ba721" +checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" dependencies = [ "js-sys", "wasm-bindgen", @@ -3319,7 +3316,7 @@ dependencies = [ [[package]] name = "websurfx" -version = "0.6.0" +version = "0.12.0" dependencies = [ "actix-files", "actix-web", @@ -3330,12 +3327,12 @@ dependencies = [ "md5", "rand 0.8.5", "redis", - "reqwest 0.11.17", + "reqwest 0.11.18", "rlua", "scraper", "serde", "serde_json", - "tokio 1.28.0", + "tokio 1.28.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ce99ca3..013f709 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "0.6.0" +version = "0.12.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 4460730ca6ba31b83512dcecc981f49618b9186c Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 1 Jun 2023 12:21:45 +0300 Subject: [PATCH 05/17] chore: make clippy github action happy --- src/config_parser/parser.rs | 2 +- src/engines/duckduckgo.rs | 2 +- src/engines/engine_models.rs | 16 +++++----------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/config_parser/parser.rs b/src/config_parser/parser.rs index ac200cd..4c5c1e6 100644 --- a/src/config_parser/parser.rs +++ b/src/config_parser/parser.rs @@ -118,7 +118,7 @@ impl Config { { Ok("./websurfx/config.lua".to_string()) } else { - Err(format!("Config file not found!!").into()) + Err("Config file not found!!".to_string().into()) } } } diff --git a/src/engines/duckduckgo.rs b/src/engines/duckduckgo.rs index 219801a..64c34c3 100644 --- a/src/engines/duckduckgo.rs +++ b/src/engines/duckduckgo.rs @@ -70,7 +70,7 @@ pub async fn results( let no_result: Selector = Selector::parse(".no-results")?; - if let Some(_) = document.select(&no_result).next() { + if document.select(&no_result).next().is_some() { return Err(EngineErrorKind::EmptyResultSet); } diff --git a/src/engines/engine_models.rs b/src/engines/engine_models.rs index 16cc266..3d0a30d 100644 --- a/src/engines/engine_models.rs +++ b/src/engines/engine_models.rs @@ -41,26 +41,20 @@ impl std::error::Error for EngineErrorKind {} /// Implementing `From` trait to map the `SelectorErrorKind` to `UnexpectedError` variant. impl<'a> From> for EngineErrorKind { fn from(err: SelectorErrorKind<'a>) -> Self { - match err { - _ => Self::UnexpectedError(err.to_string()), - } + Self::UnexpectedError(err.to_string()) } } /// Implementing `From` trait to map the `InvalidHeaderValue` to `UnexpectedError` variant. -impl<'a> From for EngineErrorKind { +impl From for EngineErrorKind { fn from(err: InvalidHeaderValue) -> Self { - match err { - _ => Self::UnexpectedError(err.to_string()), - } + Self::UnexpectedError(err.to_string()) } } /// Implementing `From` trait to map all `reqwest::Error` to `UnexpectedError` variant. -impl<'a> From for EngineErrorKind { +impl From for EngineErrorKind { fn from(err: reqwest::Error) -> Self { - match err { - _ => Self::RequestError(err), - } + Self::RequestError(err) } } From c2280b7349eeaf5ede8fed97ecfddc6864bab532 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sun, 4 Jun 2023 11:56:07 +0300 Subject: [PATCH 06/17] chore: add source and an appropriate message to different error variants --- src/engines/engine_models.rs | 47 ++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/src/engines/engine_models.rs b/src/engines/engine_models.rs index 3d0a30d..e763852 100644 --- a/src/engines/engine_models.rs +++ b/src/engines/engine_models.rs @@ -13,12 +13,15 @@ use scraper::error::SelectorErrorKind; /// search engines. /// * `UnexpectedError` - This variant handles all the errors which are unexpected or occur rarely /// and are errors mostly related to failure in initialization of HeaderMap, Selector errors and -/// all other errors. +/// all other errors occuring within the code handling the `upstream search engines`. #[derive(Debug)] pub enum EngineErrorKind { RequestError(reqwest::Error), EmptyResultSet, - UnexpectedError(String), + UnexpectedError { + message: String, + source: Option>, + }, } /// Implementing `Display` trait to make errors writable on the stdout and also providing/passing the @@ -26,29 +29,53 @@ pub enum EngineErrorKind { impl std::fmt::Display for EngineErrorKind { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - EngineErrorKind::RequestError(request_error) => write!(f, "{}", request_error), + EngineErrorKind::RequestError(request_error) => { + write!(f, "Request error: {}", request_error) + } EngineErrorKind::EmptyResultSet => { write!(f, "The upstream search engine returned an empty result set") } - EngineErrorKind::UnexpectedError(unexpected_error) => write!(f, "{}", unexpected_error), + EngineErrorKind::UnexpectedError { message, source } => { + write!(f, "Unexpected error: {}", message)?; + if let Some(source) = source { + write!(f, "\nCaused by: {}", source)?; + } + Ok(()) + } } } } -/// Implementing `Error` trait to make the the `EngineErrorKind` enum an error type. -impl std::error::Error for EngineErrorKind {} +/// Implementing `Error` trait to make the the `EngineErrorKind` enum an error type and +/// mapping `ReqwestErrors` to `RequestError` and `UnexpectedError` errors to all other unexpected +/// errors ocurring within the code handling the upstream search engines. +impl std::error::Error for EngineErrorKind { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + EngineErrorKind::RequestError(request_error) => Some(request_error), + EngineErrorKind::UnexpectedError { source, .. } => source.as_deref().map(|s| s), + _ => None, + } + } +} /// Implementing `From` trait to map the `SelectorErrorKind` to `UnexpectedError` variant. -impl<'a> From> for EngineErrorKind { - fn from(err: SelectorErrorKind<'a>) -> Self { - Self::UnexpectedError(err.to_string()) +impl From> for EngineErrorKind { + fn from(err: SelectorErrorKind<'_>) -> Self { + Self::UnexpectedError { + message: err.to_string(), + source: None, + } } } /// Implementing `From` trait to map the `InvalidHeaderValue` to `UnexpectedError` variant. impl From for EngineErrorKind { fn from(err: InvalidHeaderValue) -> Self { - Self::UnexpectedError(err.to_string()) + Self::UnexpectedError { + message: err.to_string(), + source: Some(Box::new(err)), + } } } From 39da8e8d631d55cff09aa55958f55693138c00a3 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Mon, 5 Jun 2023 12:30:14 +0300 Subject: [PATCH 07/17] build: optimise build profiles and add necessary information under package section --- Cargo.toml | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b8f2755..2e2adfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,8 +2,9 @@ name = "websurfx" version = "0.12.0" edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind." +repository = "https://github.com/neon-mmd/websurfx" +license = "AGPL-3.0" [dependencies] reqwest = {version="*",features=["json"]} @@ -25,3 +26,28 @@ once_cell = {version="*"} [dev-dependencies] rusty-hook = "^0.11.2" + +[profile.dev] +opt-level = 0 +debug = true +split-debuginfo = '...' +debug-assertions = true +overflow-checks = true +lto = false +panic = 'unwind' +incremental = true +codegen-units = 256 +rpath = false + +[profile.release] +opt-level = 3 +debug = false +split-debuginfo = '...' +debug-assertions = false +overflow-checks = false +lto = 'thin' +panic = 'unwind' +incremental = false +codegen-units = 16 +rpath = false +strip = "debuginfo" From 5689d372c3f4807d461fe73e0644feea30bd2506 Mon Sep 17 00:00:00 2001 From: alamin655 <129589283+alamin655@users.noreply.github.com> Date: Wed, 7 Jun 2023 16:14:54 +0530 Subject: [PATCH 08/17] Update search functionality with improved code This commit updates the search functionality on the website with improved code that is more readable and maintainable. The code has been refactored to use more descriptive variable and function names, and comments have been added to clarify the purpose of each block of code. Template literals and encodeURIComponent have been used to ensure proper formatting of the search query parameter, and a check has been added to ensure that the search query is not empty before redirecting the user. This update should improve the user experience by providing more reliable and consistent search functionality. The code has been tested locally to ensure that it works as intended, and no changes were made to the UI or design of the search box and results page. --- public/static/index.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/public/static/index.js b/public/static/index.js index ad52ab9..050829a 100644 --- a/public/static/index.js +++ b/public/static/index.js @@ -1,10 +1,25 @@ -let search_box = document.querySelector('input') -function search_web() { - window.location = `search?q=${search_box.value}` +/** + * Selects the input element for the search box + * @type {HTMLInputElement} + */ +const searchBox = document.querySelector('input'); + +/** + * Redirects the user to the search results page with the query parameter + */ +function searchWeb() { + const query = searchBox.value.trim(); + if (query) { + window.location.href = `search?q=${encodeURIComponent(query)}`; + } } -search_box.addEventListener('keyup', (e) => { +/** + * Listens for the 'Enter' key press event on the search box and calls the searchWeb function + * @param {KeyboardEvent} e - The keyboard event object + */ +searchBox.addEventListener('keyup', (e) => { if (e.key === 'Enter') { - search_web() + searchWeb(); } -}) +}); From 611cad72239efe5f7511d6a3b57a42a75b370f83 Mon Sep 17 00:00:00 2001 From: alamin655 <129589283+alamin655@users.noreply.github.com> Date: Wed, 7 Jun 2023 22:07:35 +0530 Subject: [PATCH 09/17] Update pagination.js --- public/static/pagination.js | 41 ++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/public/static/pagination.js b/public/static/pagination.js index 12c568f..72ce320 100644 --- a/public/static/pagination.js +++ b/public/static/pagination.js @@ -1,26 +1,39 @@ +/** + * Navigates to the next page by incrementing the current page number in the URL query parameters. + * @returns {void} + */ function navigate_forward() { - const url = new URL(window.location) - const searchParams = url.searchParams + const url = new URL(window.location); + const searchParams = url.searchParams; - let q = searchParams.get('q') - let page = searchParams.get('page') + let q = searchParams.get('q'); + let page = parseInt(searchParams.get('page')); - if (page === null) { - page = 2 - window.location = `${url.origin}${url.pathname}?q=${q}&page=${page}` + if (isNaN(page)) { + page = 1; } else { - window.location = `${url.origin}${url.pathname}?q=${q}&page=${++page}` + page++; } + + window.location.href = `${url.origin}${url.pathname}?q=${encodeURIComponent(q)}&page=${page}`; } +/** + * Navigates to the previous page by decrementing the current page number in the URL query parameters. + * @returns {void} + */ function navigate_backward() { - const url = new URL(window.location) - const searchParams = url.searchParams + const url = new URL(window.location); + const searchParams = url.searchParams; - let q = searchParams.get('q') - let page = searchParams.get('page') + let q = searchParams.get('q'); + let page = parseInt(searchParams.get('page')); - if (page !== null && page > 1) { - window.location = `${url.origin}${url.pathname}?q=${q}&page=${--page}` + if (isNaN(page)) { + page = 1; + } else if (page > 1) { + page--; } + + window.location.href = `${url.origin}${url.pathname}?q=${encodeURIComponent(q)}&page=${page}`; } From 8392a87a8bdfd338ffbf8e1cba2c53094e8d843c Mon Sep 17 00:00:00 2001 From: Bruhadeesh Siva Date: Sat, 10 Jun 2023 15:34:19 +0530 Subject: [PATCH 10/17] Update README.md Updated grammar, fixed sentence structure, and made a few sentences more engaging. A little bit of work was also done to make the language more confident as well as welcoming to new contributors. Cheers! --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 36b358b..29f2cb2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

+

websurfx logo

@@ -39,7 +39,7 @@ >meta search engine (pronounced as websurface or web-surface /wɛbˈsɜːrfəs/.) written in Rust. It - provides a quick and secure search experience while maintaining user + provides a quick and secure search experience while completely respecting user privacy.

@@ -72,7 +72,7 @@ # Preview 🔭 -## Main Page +## Home Page @@ -88,7 +88,7 @@ # Features 🚀 -- 🎨 High level of customizability with nine color schemes provided by default with a simple theme, also supporting the creation of your custom themes and colorschemes very quickly and easily +- 🎨 Make Websurfx uniquely yours with nine color schemes provided by default. It also supports creation of custom themes and color schemes in a quick and easy way, so unleash your creativity! - 🔐 Fast, private, and secure - 🆓 100% free and open source - 💨 Ad-free and clean results @@ -116,7 +116,7 @@ redis-server --port 8082 & Once you have started the server, open your preferred web browser and navigate to to start using Websurfx. > **Warning** -> Please be aware that the project is still in the testing phase and is not ready for production use. +> This project is still in the testing phase and is **not** ready for production use. **[⬆️ Back to Top](#--)** @@ -132,14 +132,14 @@ Websurfx is configured through the config.lua file, located at `websurfx/config. > For full theming and customization instructions, see: [**Theming**](./docs/theming.md) -Websurfx comes with several themes and color schemes by default, which you can apply and edit through the config file. Supports custom themes and color schemes using CSS, allowing you to develop your own unique-looking website. +Websurfx comes loaded with several themes and color schemes, which you can apply and edit through the config file. It also supports custom themes and color schemes using CSS, allowing you to make it truly yours. **[⬆️ Back to Top](#--)** # Multi-Language Support 🌍 > **Note** -> Currently, we do not support other languages, but in the future, we will start accepting contributions regarding language support because we believe that language should not be a barrier to entry. +> Currently, we do not support other languages but we will start accepting contributions regarding language support in the future. We believe language should never be a barrier to entry. **[⬆️ Back to Top](#--)** @@ -153,15 +153,15 @@ At present, we only support x86_64 architecture systems, but we would love to ha ## Why Websurfx? -The primary purpose of the Websurfx project is to create a fast, secure, and privacy-focused meta-search engine. While there are numerous meta-search engines available, not all of them guarantee the security of their search engine, which is critical for maintaining privacy. Memory flaws, for example, can expose private or sensitive information, which is never a good thing. Also, there is the added problem of Spam, ads, and unorganic results which most engines don't have the full-proof answer to it till now but with Websurfx I finally put a full stop to this problem, also, Rust is used to write Websurfx, which ensures memory safety and removes such issues. Many meta-search engines also lack important features like advanced picture search, which is required by many graphic designers, content providers, and others. Websurfx attempts to improve the user experience by providing these and other features, such as proper NSFW blocking and Micro-apps or Quick results (like providing a calculator, currency exchanges, etc in the search results). +The primary purpose of the Websurfx project is to create a fast, secure, and privacy-focused meta-search engine. There are numerous meta-search engines available, but not all guarantee the security of their search engine, which is critical for maintaining privacy. Memory flaws, for example, can expose private or sensitive information, which is understandably bad. There is also the added problem of spam, ads, and inorganic results which most engines don't have a fool-proof answer to. Until now. With Websurfx I finally put a full stop to this problem. Websurfx is based on Rust, which ensures memory safety and removes such issues. Many meta-search engines also lack important features like advanced picture search, required by graphic designers, content providers, and others. Websurfx improves the user experience by providing these and other features, such as proper NSFW blocking and Micro-apps or Quick Results (providing a calculator, currency exchanges, etc in the search results). ## Why AGPLv3? -Websurfx is distributed under the **AGPLv3** license to keep the source code open and transparent. This helps to keep malware, telemetry, and other dangerous programs out of the project. **AGPLv3** is a strong copyleft license that ensures the software's source code, including any modifications or improvements made to the code, remains open and available to everyone. +Websurfx is distributed under the **AGPLv3** license to keep the source code open and transparent. This helps keep malware, telemetry, and other dangers out of the project. **AGPLv3** is a strong copyleft license that ensures the software's source code, including any modifications or improvements made to the code, remains open and available to everyone. ## Why Rust? -Rust was chosen as the programming language for Websurfx because of its memory safety features, which can help prevent vulnerabilities and make the codebase more secure. Rust is also faster than C++, which contributes to Websurfx's speed and responsiveness. Furthermore, the Rust ownership and borrowing system enables secure concurrency and thread safety in the program. +Websurfx is based on Rust due to its memory safety features, which prevents vulnerabilities and makes the codebase more secure. Rust is also faster than C++, contributing to Websurfx's speed and responsiveness. Finally, the Rust ownership and borrowing system enables secure concurrency and thread safety in the program. **[⬆️ Back to Top](#--)** @@ -175,14 +175,14 @@ We are looking for more willing contributors to help grow this project. For more > For full details and other ways you can help out, see: [**Contributing**]() -If you use Websurfx and would like to contribute to its development, that would be fantastic! Contributions of any size or type are always welcome, and we will properly acknowledge your efforts. +If you use Websurfx and would like to contribute to its development, we're glad to have you on board! Contributions of any size or type are always welcome, and we will always acknowledge your efforts. Several areas that we need a bit of help with at the moment are: - **Better and more color schemes**: Help fix color schemes and add other famous color schemes. - **Improve evasion code for bot detection** - Help improve code related to evading IP blocking and emulating human behaviors located in everyone's engine file. - **Logo** - Help create a logo for the project and website. - **Docker Support** - Help write a Docker Compose file for the project. -- Submit a PR to add a new feature, fix a bug, update the docs, add a theme, widget, or something else. +- Submit a PR to add a new feature, fix a bug, update the docs, add a theme, widget, or anything else. - Star Websurfx on GitHub. **[⬆️ Back to Top](#--)** @@ -196,13 +196,13 @@ Several areas that we need a bit of help with at the moment are: # Roadmap 🛣️ -> Coming soon!! 🙂. +> Coming soon! 🙂. **[⬆️ Back to Top](#--)** # Contributing 🙋 -Contributions are welcome from anyone. It doesn\'t matter who you are; you can still contribute to the project in your own way. +Contributions are welcome from anyone. It doesn't matter who you are; you can still contribute to the project in your own way. ## Not a developer but still want to contribute? From 9a4cf949e42d13882c1f428b5d01f6a35f299e59 Mon Sep 17 00:00:00 2001 From: xffxff <1247714429@qq.com> Date: Wed, 14 Jun 2023 20:42:30 +0800 Subject: [PATCH 11/17] improve error handling by using `error-stack` crate --- Cargo.lock | 17 +++++++++ Cargo.toml | 1 + src/engines/duckduckgo.rs | 70 ++++++++++++++++++++++++++-------- src/engines/engine_models.rs | 73 ++++++------------------------------ src/engines/searx.rs | 62 +++++++++++++++++++++++------- 5 files changed, 133 insertions(+), 90 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3b4f93..568ca5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -268,6 +268,12 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "anyhow" +version = "1.0.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" + [[package]] name = "askama_escape" version = "0.10.3" @@ -733,6 +739,16 @@ dependencies = [ "libc", ] +[[package]] +name = "error-stack" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f00447f331c7f726db5b8532ebc9163519eed03c6d7c8b73c90b3ff5646ac85" +dependencies = [ + "anyhow", + "rustc_version 0.4.0", +] + [[package]] name = "failure" version = "0.1.8" @@ -3373,6 +3389,7 @@ dependencies = [ "actix-files", "actix-web", "env_logger", + "error-stack", "fake-useragent", "handlebars", "log", diff --git a/Cargo.toml b/Cargo.toml index 2e2adfb..9102880 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ redis = {version="*"} md5 = {version="*"} rand={version="*"} once_cell = {version="*"} +error-stack = "0.3.1" [dev-dependencies] rusty-hook = "^0.11.2" diff --git a/src/engines/duckduckgo.rs b/src/engines/duckduckgo.rs index 64c34c3..70c3a87 100644 --- a/src/engines/duckduckgo.rs +++ b/src/engines/duckduckgo.rs @@ -9,7 +9,9 @@ use scraper::{Html, Selector}; use crate::search_results_handler::aggregation_models::RawSearchResult; -use super::engine_models::EngineErrorKind; +use super::engine_models::EngineError; + +use error_stack::{IntoReport, Report, Result, ResultExt}; /// This function scrapes results from the upstream engine duckduckgo and puts all the scraped /// results like title, visiting_url (href in html),engine (from which engine it was fetched from) @@ -32,7 +34,7 @@ pub async fn results( query: &str, page: u32, user_agent: &str, -) -> Result, EngineErrorKind> { +) -> Result, EngineError> { // Page number can be missing or empty string and so appropriate handling is required // so that upstream server recieves valid page number. let url: String = match page { @@ -51,33 +53,71 @@ pub async fn results( // initializing HeaderMap and adding appropriate headers. let mut header_map = HeaderMap::new(); - header_map.insert(USER_AGENT, user_agent.parse()?); - header_map.insert(REFERER, "https://google.com/".parse()?); - header_map.insert(CONTENT_TYPE, "application/x-www-form-urlencoded".parse()?); - header_map.insert(COOKIE, "kl=wt-wt".parse()?); + header_map.insert( + USER_AGENT, + user_agent + .parse() + .into_report() + .change_context(EngineError::UnexpectedError)?, + ); + header_map.insert( + REFERER, + "https://google.com/" + .parse() + .into_report() + .change_context(EngineError::UnexpectedError)?, + ); + header_map.insert( + CONTENT_TYPE, + "application/x-www-form-urlencoded" + .parse() + .into_report() + .change_context(EngineError::UnexpectedError)?, + ); + header_map.insert( + COOKIE, + "kl=wt-wt" + .parse() + .into_report() + .change_context(EngineError::UnexpectedError)?, + ); // fetch the html from upstream duckduckgo engine let results: String = reqwest::Client::new() .get(url) - .timeout(Duration::from_secs(30)) + .timeout(Duration::from_secs(5)) .headers(header_map) // add spoofed headers to emulate human behaviour .send() - .await? + .await + .into_report() + .change_context(EngineError::RequestError)? .text() - .await?; + .await + .into_report() + .change_context(EngineError::RequestError)?; let document: Html = Html::parse_document(&results); - let no_result: Selector = Selector::parse(".no-results")?; + let no_result: Selector = Selector::parse(".no-results") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", ".no-results"))?; if document.select(&no_result).next().is_some() { - return Err(EngineErrorKind::EmptyResultSet); + return Err(Report::new(EngineError::EmptyResultSet)); } - let results: Selector = Selector::parse(".result")?; - let result_title: Selector = Selector::parse(".result__a")?; - let result_url: Selector = Selector::parse(".result__url")?; - let result_desc: Selector = Selector::parse(".result__snippet")?; + let results: Selector = Selector::parse(".result") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", ".result"))?; + let result_title: Selector = Selector::parse(".result__a") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", ".result__a"))?; + let result_url: Selector = Selector::parse(".result__url") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", ".result__url"))?; + let result_desc: Selector = Selector::parse(".result__snippet") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", ".result__snippet"))?; // scrape all the results from the html Ok(document diff --git a/src/engines/engine_models.rs b/src/engines/engine_models.rs index e763852..7f44237 100644 --- a/src/engines/engine_models.rs +++ b/src/engines/engine_models.rs @@ -1,8 +1,8 @@ //! This module provides the error enum to handle different errors associated while requesting data from //! the upstream search engines with the search query provided by the user. -use reqwest::header::InvalidHeaderValue; -use scraper::error::SelectorErrorKind; +use error_stack::Context; +use std::fmt; /// A custom error type used for handle engine associated errors. /// @@ -15,73 +15,24 @@ use scraper::error::SelectorErrorKind; /// and are errors mostly related to failure in initialization of HeaderMap, Selector errors and /// all other errors occuring within the code handling the `upstream search engines`. #[derive(Debug)] -pub enum EngineErrorKind { - RequestError(reqwest::Error), +pub enum EngineError { EmptyResultSet, - UnexpectedError { - message: String, - source: Option>, - }, + RequestError, + UnexpectedError, } -/// Implementing `Display` trait to make errors writable on the stdout and also providing/passing the -/// appropriate errors that should be written to the stdout when this error is raised/encountered. -impl std::fmt::Display for EngineErrorKind { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl fmt::Display for EngineError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - EngineErrorKind::RequestError(request_error) => { - write!(f, "Request error: {}", request_error) - } - EngineErrorKind::EmptyResultSet => { + EngineError::EmptyResultSet => { write!(f, "The upstream search engine returned an empty result set") } - EngineErrorKind::UnexpectedError { message, source } => { - write!(f, "Unexpected error: {}", message)?; - if let Some(source) = source { - write!(f, "\nCaused by: {}", source)?; - } - Ok(()) + EngineError::RequestError => { + write!(f, "Request error") } + EngineError::UnexpectedError => write!(f, "Unexpected error"), } } } -/// Implementing `Error` trait to make the the `EngineErrorKind` enum an error type and -/// mapping `ReqwestErrors` to `RequestError` and `UnexpectedError` errors to all other unexpected -/// errors ocurring within the code handling the upstream search engines. -impl std::error::Error for EngineErrorKind { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - match self { - EngineErrorKind::RequestError(request_error) => Some(request_error), - EngineErrorKind::UnexpectedError { source, .. } => source.as_deref().map(|s| s), - _ => None, - } - } -} - -/// Implementing `From` trait to map the `SelectorErrorKind` to `UnexpectedError` variant. -impl From> for EngineErrorKind { - fn from(err: SelectorErrorKind<'_>) -> Self { - Self::UnexpectedError { - message: err.to_string(), - source: None, - } - } -} - -/// Implementing `From` trait to map the `InvalidHeaderValue` to `UnexpectedError` variant. -impl From for EngineErrorKind { - fn from(err: InvalidHeaderValue) -> Self { - Self::UnexpectedError { - message: err.to_string(), - source: Some(Box::new(err)), - } - } -} - -/// Implementing `From` trait to map all `reqwest::Error` to `UnexpectedError` variant. -impl From for EngineErrorKind { - fn from(err: reqwest::Error) -> Self { - Self::RequestError(err) - } -} +impl Context for EngineError {} diff --git a/src/engines/searx.rs b/src/engines/searx.rs index feab464..bc68608 100644 --- a/src/engines/searx.rs +++ b/src/engines/searx.rs @@ -8,7 +8,8 @@ use std::collections::HashMap; use crate::search_results_handler::aggregation_models::RawSearchResult; -use super::engine_models::EngineErrorKind; +use super::engine_models::EngineError; +use error_stack::{IntoReport, Report, Result, ResultExt}; /// This function scrapes results from the upstream engine duckduckgo and puts all the scraped /// results like title, visiting_url (href in html),engine (from which engine it was fetched from) @@ -31,43 +32,76 @@ pub async fn results( query: &str, page: u32, user_agent: &str, -) -> Result, EngineErrorKind> { +) -> Result, EngineError> { // Page number can be missing or empty string and so appropriate handling is required // so that upstream server recieves valid page number. let url: String = format!("https://searx.work/search?q={query}&pageno={page}"); // initializing headers and adding appropriate headers. let mut header_map = HeaderMap::new(); - header_map.insert(USER_AGENT, user_agent.parse()?); - header_map.insert(REFERER, "https://google.com/".parse()?); - header_map.insert(CONTENT_TYPE, "application/x-www-form-urlencoded".parse()?); - header_map.insert(COOKIE, "categories=general; language=auto; locale=en; autocomplete=duckduckgo; image_proxy=1; method=POST; safesearch=2; theme=simple; results_on_new_tab=1; doi_resolver=oadoi.org; simple_style=auto; center_alignment=1; query_in_title=1; infinite_scroll=0; disabled_engines=; enabled_engines=\"archive is__general\\054yep__general\\054curlie__general\\054currency__general\\054ddg definitions__general\\054wikidata__general\\054duckduckgo__general\\054tineye__general\\054lingva__general\\054startpage__general\\054yahoo__general\\054wiby__general\\054marginalia__general\\054alexandria__general\\054wikibooks__general\\054wikiquote__general\\054wikisource__general\\054wikiversity__general\\054wikivoyage__general\\054dictzone__general\\054seznam__general\\054mojeek__general\\054naver__general\\054wikimini__general\\054brave__general\\054petalsearch__general\\054goo__general\"; disabled_plugins=; enabled_plugins=\"searx.plugins.hostname_replace\\054searx.plugins.oa_doi_rewrite\\054searx.plugins.vim_hotkeys\"; tokens=; maintab=on; enginetab=on".parse()?); + header_map.insert( + USER_AGENT, + user_agent + .parse() + .into_report() + .change_context(EngineError::UnexpectedError)?, + ); + header_map.insert( + REFERER, + "https://google.com/" + .parse() + .into_report() + .change_context(EngineError::UnexpectedError)?, + ); + header_map.insert( + CONTENT_TYPE, + "application/x-www-form-urlencoded" + .parse() + .into_report() + .change_context(EngineError::UnexpectedError)?, + ); + header_map.insert(COOKIE, "categories=general; language=auto; locale=en; autocomplete=duckduckgo; image_proxy=1; method=POST; safesearch=2; theme=simple; results_on_new_tab=1; doi_resolver=oadoi.org; simple_style=auto; center_alignment=1; query_in_title=1; infinite_scroll=0; disabled_engines=; enabled_engines=\"archive is__general\\054yep__general\\054curlie__general\\054currency__general\\054ddg definitions__general\\054wikidata__general\\054duckduckgo__general\\054tineye__general\\054lingva__general\\054startpage__general\\054yahoo__general\\054wiby__general\\054marginalia__general\\054alexandria__general\\054wikibooks__general\\054wikiquote__general\\054wikisource__general\\054wikiversity__general\\054wikivoyage__general\\054dictzone__general\\054seznam__general\\054mojeek__general\\054naver__general\\054wikimini__general\\054brave__general\\054petalsearch__general\\054goo__general\"; disabled_plugins=; enabled_plugins=\"searx.plugins.hostname_replace\\054searx.plugins.oa_doi_rewrite\\054searx.plugins.vim_hotkeys\"; tokens=; maintab=on; enginetab=on".parse().into_report().change_context(EngineError::UnexpectedError)?); // fetch the html from upstream searx instance engine let results: String = reqwest::Client::new() .get(url) .headers(header_map) // add spoofed headers to emulate human behaviours. .send() - .await? + .await + .into_report() + .change_context(EngineError::RequestError)? .text() - .await?; + .await + .into_report() + .change_context(EngineError::RequestError)?; let document: Html = Html::parse_document(&results); - let no_result: Selector = Selector::parse("#urls>.dialog-error>p")?; + let no_result: Selector = Selector::parse("#urls>.dialog-error>p") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", "#urls>.dialog-error>p"))?; if let Some(no_result_msg) = document.select(&no_result).nth(1) { if no_result_msg.inner_html() == "we didn't find any results. Please use another query or search in more categories" { - return Err(EngineErrorKind::EmptyResultSet); + return Err(Report::new(EngineError::EmptyResultSet)); } } - let results: Selector = Selector::parse(".result")?; - let result_title: Selector = Selector::parse("h3>a")?; - let result_url: Selector = Selector::parse("h3>a")?; - let result_desc: Selector = Selector::parse(".content")?; + let results: Selector = Selector::parse(".result") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", ".result"))?; + let result_title: Selector = Selector::parse("h3>a") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", "h3>a"))?; + let result_url: Selector = Selector::parse("h3>a") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", "h3>a"))?; + + let result_desc: Selector = Selector::parse(".content") + .map_err(|_| Report::new(EngineError::UnexpectedError)) + .attach_printable_lazy(|| format!("invalid CSS selector: {}", ".content"))?; // scrape all the results from the html Ok(document From 1ebf888085c10aa7ea6a544e74df0b10f845223b Mon Sep 17 00:00:00 2001 From: xffxff <1247714429@qq.com> Date: Thu, 15 Jun 2023 06:27:45 +0800 Subject: [PATCH 12/17] log the error from engines --- src/search_results_handler/aggregator.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/search_results_handler/aggregator.rs b/src/search_results_handler/aggregator.rs index 8b6bae3..cba266c 100644 --- a/src/search_results_handler/aggregator.rs +++ b/src/search_results_handler/aggregator.rs @@ -58,8 +58,19 @@ pub async fn aggregate( searx::results(query, page, &user_agent) ); - let ddg_map_results: HashMap = ddg_map_results?; - let searx_map_results: HashMap = searx_map_results?; + let ddg_map_results = ddg_map_results.unwrap_or_else(|e| { + if debug { + log::error!("Error fetching results from DuckDuckGo: {:?}", e); + } + HashMap::new() + }); + + let searx_map_results = searx_map_results.unwrap_or_else(|e| { + if debug { + log::error!("Error fetching results from Searx: {:?}", e); + } + HashMap::new() + }); result_map.extend(ddg_map_results); From b6faa097507263cabfce431aeb652d1bd832c4cc Mon Sep 17 00:00:00 2001 From: zhou fan <1247714429@qq.com> Date: Thu, 15 Jun 2023 06:28:21 +0800 Subject: [PATCH 13/17] Update src/engines/engine_models.rs Co-authored-by: neon_arch --- src/engines/engine_models.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engines/engine_models.rs b/src/engines/engine_models.rs index 7f44237..9ffc77f 100644 --- a/src/engines/engine_models.rs +++ b/src/engines/engine_models.rs @@ -28,9 +28,9 @@ impl fmt::Display for EngineError { write!(f, "The upstream search engine returned an empty result set") } EngineError::RequestError => { - write!(f, "Request error") + write!(f, "Error occurred while requesting data from upstream search engine") } - EngineError::UnexpectedError => write!(f, "Unexpected error"), + EngineError::UnexpectedError => write!(f, "An unexpected error occurred while processing the data"), } } } From ebb9e9ee2b2db7d67e9a6ab9c2fdc77c023a4c22 Mon Sep 17 00:00:00 2001 From: xffxff <1247714429@qq.com> Date: Thu, 15 Jun 2023 06:48:37 +0800 Subject: [PATCH 14/17] make format happy --- src/engines/engine_models.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/engines/engine_models.rs b/src/engines/engine_models.rs index 9ffc77f..7a58688 100644 --- a/src/engines/engine_models.rs +++ b/src/engines/engine_models.rs @@ -28,9 +28,14 @@ impl fmt::Display for EngineError { write!(f, "The upstream search engine returned an empty result set") } EngineError::RequestError => { - write!(f, "Error occurred while requesting data from upstream search engine") + write!( + f, + "Error occurred while requesting data from upstream search engine" + ) + } + EngineError::UnexpectedError => { + write!(f, "An unexpected error occurred while processing the data") } - EngineError::UnexpectedError => write!(f, "An unexpected error occurred while processing the data"), } } } From 2d6f1415140de1dc63dbceee68ce0efcd2491b67 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 15 Jun 2023 18:09:12 +0300 Subject: [PATCH 15/17] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20fix:=20bump=20the?= =?UTF-8?q?=20version=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 277 ++++++++++++++++++++++++----------------------------- Cargo.toml | 2 +- 2 files changed, 126 insertions(+), 153 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 568ca5f..3f0a607 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,7 +38,7 @@ dependencies = [ "log", "mime", "mime_guess", - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", "pin-project-lite", ] @@ -70,7 +70,7 @@ dependencies = [ "language-tags", "local-channel", "mime", - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", "pin-project-lite", "rand 0.8.5", "sha1", @@ -190,8 +190,8 @@ dependencies = [ "serde_urlencoded 0.7.1", "smallvec 1.10.0", "socket2", - "time 0.3.21", - "url 2.3.1", + "time 0.3.22", + "url 2.4.0", ] [[package]] @@ -201,7 +201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2262160a7ae29e3415554a3f1fc04c764b1540c116aa524683208078b7a75bc9" dependencies = [ "actix-router", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", ] @@ -227,7 +227,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -239,16 +239,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if 1.0.0", - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -494,8 +494,8 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ - "percent-encoding 2.2.0", - "time 0.3.21", + "percent-encoding 2.3.0", + "time 0.3.22", "version_check", ] @@ -620,7 +620,7 @@ dependencies = [ "itoa 1.0.6", "matches", "phf 0.10.1", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "smallvec 1.10.0", "syn 1.0.109", @@ -628,12 +628,12 @@ dependencies = [ [[package]] name = "cssparser-macros" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote 1.0.28", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] @@ -643,7 +643,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "rustc_version 0.4.0", "syn 1.0.109", @@ -666,12 +666,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" [[package]] -name = "dtoa-short" -version = "0.3.3" +name = "dtoa" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6" +checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" + +[[package]] +name = "dtoa-short" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" dependencies = [ - "dtoa", + "dtoa 1.0.6", ] [[package]] @@ -765,7 +771,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", "synstructure", @@ -824,11 +830,11 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", ] [[package]] @@ -965,9 +971,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if 1.0.0", "libc", @@ -976,9 +982,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "h2" @@ -1076,7 +1082,7 @@ dependencies = [ "log", "mac", "markup5ever 0.11.0", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", ] @@ -1201,7 +1207,7 @@ dependencies = [ "tokio 1.28.2", "tower-service", "tracing", - "want 0.3.0", + "want 0.3.1", ] [[package]] @@ -1254,9 +1260,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1342,9 +1348,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1373,9 +1379,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "linux-raw-sys" @@ -1412,9 +1418,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg 1.1.0", "scopeguard", @@ -1422,9 +1428,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "mac" @@ -1593,9 +1599,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.38" +version = "0.2.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" +checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" dependencies = [ "cfg-if 0.1.10", "libc", @@ -1641,24 +1647,24 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.17.2" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "openssl" -version = "0.10.53" +version = "0.10.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12df40a956736488b7b44fe79fe12d4f245bb5b3f5a1f6095e499760015be392" +checksum = "69b3f656a17a6cbc115b5c7a40c616947d213ba182135b014d6051b73ab6f019" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1675,7 +1681,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -1715,8 +1721,8 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api 0.4.9", - "parking_lot_core 0.9.7", + "lock_api 0.4.10", + "parking_lot_core 0.9.8", ] [[package]] @@ -1736,15 +1742,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec 1.10.0", - "windows-sys 0.45.0", + "windows-targets", ] [[package]] @@ -1761,9 +1767,9 @@ checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" @@ -1793,7 +1799,7 @@ checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -1907,7 +1913,7 @@ dependencies = [ "phf_generator 0.10.0", "phf_shared 0.10.0", "proc-macro-hack", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", ] @@ -1986,9 +1992,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -2000,7 +2006,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b4ce31ff0a27d93c8de1849cf58162283752f065a90d508f1105fa6c9a213f" dependencies = [ "idna 0.2.3", - "url 2.3.1", + "url 2.4.0", ] [[package]] @@ -2018,7 +2024,7 @@ version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", ] [[package]] @@ -2125,7 +2131,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -2225,10 +2231,10 @@ checksum = "3ea8c51b5dc1d8e5fd3350ec8167f464ec0995e79f2e90a075b63371500d557f" dependencies = [ "combine", "itoa 1.0.6", - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", "ryu", "sha1_smol", - "url 2.3.1", + "url 2.4.0", ] [[package]] @@ -2237,15 +2243,6 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -2257,9 +2254,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.3" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", @@ -2328,7 +2325,7 @@ dependencies = [ "mime", "native-tls", "once_cell", - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", "pin-project-lite", "serde", "serde_json", @@ -2336,7 +2333,7 @@ dependencies = [ "tokio 1.28.2", "tokio-native-tls", "tower-service", - "url 2.3.1", + "url 2.4.0", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -2345,9 +2342,9 @@ dependencies = [ [[package]] name = "rlua" -version = "0.19.4" +version = "0.19.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b38117a836316ef62c02f6751e6d28e2eb53a1c35f0329427a9fb9c1c7b6a0" +checksum = "753540fb29c9a615ce5dd64be5c957271adc887c8424555fc372e0b88ebde074" dependencies = [ "bitflags", "bstr", @@ -2358,9 +2355,9 @@ dependencies = [ [[package]] name = "rlua-lua54-sys" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f42202b5aeb0bcc5df28436f8d963f8cbcbb898033a9e28c7ba4f299707934" +checksum = "28b1af7df13ef18849005d82d8d16411ebdb7f35f9dcfcb790a4ce49bc1e05aa" dependencies = [ "cc", "libc", @@ -2393,9 +2390,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno", @@ -2538,20 +2535,20 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -2573,7 +2570,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" dependencies = [ - "dtoa", + "dtoa 0.4.8", "itoa 0.4.8", "serde", "url 1.7.2", @@ -2736,7 +2733,7 @@ checksum = "f0f45ed1b65bf9a4bf2f7b7dc59212d1926e9eaf00fa998988e420fd124467c6" dependencies = [ "phf_generator 0.7.24", "phf_shared 0.7.24", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "string_cache_shared", ] @@ -2749,7 +2746,7 @@ checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ "phf_generator 0.10.0", "phf_shared 0.10.0", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", ] @@ -2776,7 +2773,7 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "unicode-ident", ] @@ -2787,7 +2784,7 @@ version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "unicode-ident", ] @@ -2798,7 +2795,7 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", "unicode-xid 0.2.4", @@ -2806,15 +2803,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg 1.1.0", "cfg-if 1.0.0", "fastrand", "redox_syscall 0.3.5", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2852,7 +2850,7 @@ version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -2870,9 +2868,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa 1.0.6", "serde", @@ -2996,7 +2994,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -3221,13 +3219,13 @@ dependencies = [ [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", - "idna 0.3.0", - "percent-encoding 2.2.0", + "idna 0.4.0", + "percent-encoding 2.3.0", ] [[package]] @@ -3280,11 +3278,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -3308,9 +3305,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3318,14 +3315,14 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", "wasm-bindgen-shared", @@ -3333,9 +3330,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3345,9 +3342,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote 1.0.28", "wasm-bindgen-macro-support", @@ -3355,11 +3352,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", "wasm-bindgen-backend", @@ -3368,15 +3365,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -3384,7 +3381,7 @@ dependencies = [ [[package]] name = "websurfx" -version = "0.12.0" +version = "0.12.2" dependencies = [ "actix-files", "actix-web", @@ -3464,37 +3461,13 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9102880..7a848d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "0.12.0" +version = "0.12.2" edition = "2021" description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind." repository = "https://github.com/neon-mmd/websurfx" From d2967a90cb158e67e1cc5ae689d68e7b2a654483 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 15 Jun 2023 18:19:10 +0300 Subject: [PATCH 16/17] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20style:=20make=20c?= =?UTF-8?q?argo.toml=20consistent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9102880..a0b25fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ redis = {version="*"} md5 = {version="*"} rand={version="*"} once_cell = {version="*"} -error-stack = "0.3.1" +error-stack = {version="0.3.1"} [dev-dependencies] rusty-hook = "^0.11.2" From 695688daa21fa463b4a40934cf01239dc14c38b3 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 15 Jun 2023 18:24:31 +0300 Subject: [PATCH 17/17] =?UTF-8?q?=F0=9F=9A=80=20chore:=20bump=20the=20app?= =?UTF-8?q?=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 277 ++++++++++++++++++++++++----------------------------- Cargo.toml | 2 +- 2 files changed, 126 insertions(+), 153 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 568ca5f..9d3c8b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,7 +38,7 @@ dependencies = [ "log", "mime", "mime_guess", - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", "pin-project-lite", ] @@ -70,7 +70,7 @@ dependencies = [ "language-tags", "local-channel", "mime", - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", "pin-project-lite", "rand 0.8.5", "sha1", @@ -190,8 +190,8 @@ dependencies = [ "serde_urlencoded 0.7.1", "smallvec 1.10.0", "socket2", - "time 0.3.21", - "url 2.3.1", + "time 0.3.22", + "url 2.4.0", ] [[package]] @@ -201,7 +201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2262160a7ae29e3415554a3f1fc04c764b1540c116aa524683208078b7a75bc9" dependencies = [ "actix-router", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", ] @@ -227,7 +227,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -239,16 +239,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if 1.0.0", - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -494,8 +494,8 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ - "percent-encoding 2.2.0", - "time 0.3.21", + "percent-encoding 2.3.0", + "time 0.3.22", "version_check", ] @@ -620,7 +620,7 @@ dependencies = [ "itoa 1.0.6", "matches", "phf 0.10.1", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "smallvec 1.10.0", "syn 1.0.109", @@ -628,12 +628,12 @@ dependencies = [ [[package]] name = "cssparser-macros" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote 1.0.28", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] @@ -643,7 +643,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "rustc_version 0.4.0", "syn 1.0.109", @@ -666,12 +666,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" [[package]] -name = "dtoa-short" -version = "0.3.3" +name = "dtoa" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6" +checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" + +[[package]] +name = "dtoa-short" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" dependencies = [ - "dtoa", + "dtoa 1.0.6", ] [[package]] @@ -765,7 +771,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", "synstructure", @@ -824,11 +830,11 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", ] [[package]] @@ -965,9 +971,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if 1.0.0", "libc", @@ -976,9 +982,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "h2" @@ -1076,7 +1082,7 @@ dependencies = [ "log", "mac", "markup5ever 0.11.0", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", ] @@ -1201,7 +1207,7 @@ dependencies = [ "tokio 1.28.2", "tower-service", "tracing", - "want 0.3.0", + "want 0.3.1", ] [[package]] @@ -1254,9 +1260,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1342,9 +1348,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1373,9 +1379,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "linux-raw-sys" @@ -1412,9 +1418,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg 1.1.0", "scopeguard", @@ -1422,9 +1428,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "mac" @@ -1593,9 +1599,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.38" +version = "0.2.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" +checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" dependencies = [ "cfg-if 0.1.10", "libc", @@ -1641,24 +1647,24 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.17.2" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "openssl" -version = "0.10.53" +version = "0.10.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12df40a956736488b7b44fe79fe12d4f245bb5b3f5a1f6095e499760015be392" +checksum = "69b3f656a17a6cbc115b5c7a40c616947d213ba182135b014d6051b73ab6f019" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1675,7 +1681,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -1715,8 +1721,8 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api 0.4.9", - "parking_lot_core 0.9.7", + "lock_api 0.4.10", + "parking_lot_core 0.9.8", ] [[package]] @@ -1736,15 +1742,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec 1.10.0", - "windows-sys 0.45.0", + "windows-targets", ] [[package]] @@ -1761,9 +1767,9 @@ checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" @@ -1793,7 +1799,7 @@ checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -1907,7 +1913,7 @@ dependencies = [ "phf_generator 0.10.0", "phf_shared 0.10.0", "proc-macro-hack", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", ] @@ -1986,9 +1992,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -2000,7 +2006,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b4ce31ff0a27d93c8de1849cf58162283752f065a90d508f1105fa6c9a213f" dependencies = [ "idna 0.2.3", - "url 2.3.1", + "url 2.4.0", ] [[package]] @@ -2018,7 +2024,7 @@ version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", ] [[package]] @@ -2125,7 +2131,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -2225,10 +2231,10 @@ checksum = "3ea8c51b5dc1d8e5fd3350ec8167f464ec0995e79f2e90a075b63371500d557f" dependencies = [ "combine", "itoa 1.0.6", - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", "ryu", "sha1_smol", - "url 2.3.1", + "url 2.4.0", ] [[package]] @@ -2237,15 +2243,6 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -2257,9 +2254,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.3" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", @@ -2328,7 +2325,7 @@ dependencies = [ "mime", "native-tls", "once_cell", - "percent-encoding 2.2.0", + "percent-encoding 2.3.0", "pin-project-lite", "serde", "serde_json", @@ -2336,7 +2333,7 @@ dependencies = [ "tokio 1.28.2", "tokio-native-tls", "tower-service", - "url 2.3.1", + "url 2.4.0", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -2345,9 +2342,9 @@ dependencies = [ [[package]] name = "rlua" -version = "0.19.4" +version = "0.19.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b38117a836316ef62c02f6751e6d28e2eb53a1c35f0329427a9fb9c1c7b6a0" +checksum = "753540fb29c9a615ce5dd64be5c957271adc887c8424555fc372e0b88ebde074" dependencies = [ "bitflags", "bstr", @@ -2358,9 +2355,9 @@ dependencies = [ [[package]] name = "rlua-lua54-sys" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f42202b5aeb0bcc5df28436f8d963f8cbcbb898033a9e28c7ba4f299707934" +checksum = "28b1af7df13ef18849005d82d8d16411ebdb7f35f9dcfcb790a4ce49bc1e05aa" dependencies = [ "cc", "libc", @@ -2393,9 +2390,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno", @@ -2538,20 +2535,20 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -2573,7 +2570,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" dependencies = [ - "dtoa", + "dtoa 0.4.8", "itoa 0.4.8", "serde", "url 1.7.2", @@ -2736,7 +2733,7 @@ checksum = "f0f45ed1b65bf9a4bf2f7b7dc59212d1926e9eaf00fa998988e420fd124467c6" dependencies = [ "phf_generator 0.7.24", "phf_shared 0.7.24", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "string_cache_shared", ] @@ -2749,7 +2746,7 @@ checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ "phf_generator 0.10.0", "phf_shared 0.10.0", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", ] @@ -2776,7 +2773,7 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "unicode-ident", ] @@ -2787,7 +2784,7 @@ version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "unicode-ident", ] @@ -2798,7 +2795,7 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 1.0.109", "unicode-xid 0.2.4", @@ -2806,15 +2803,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg 1.1.0", "cfg-if 1.0.0", "fastrand", "redox_syscall 0.3.5", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2852,7 +2850,7 @@ version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -2870,9 +2868,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa 1.0.6", "serde", @@ -2996,7 +2994,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", ] @@ -3221,13 +3219,13 @@ dependencies = [ [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", - "idna 0.3.0", - "percent-encoding 2.2.0", + "idna 0.4.0", + "percent-encoding 2.3.0", ] [[package]] @@ -3280,11 +3278,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -3308,9 +3305,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3318,14 +3315,14 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", "wasm-bindgen-shared", @@ -3333,9 +3330,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3345,9 +3342,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote 1.0.28", "wasm-bindgen-macro-support", @@ -3355,11 +3352,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ - "proc-macro2 1.0.59", + "proc-macro2 1.0.60", "quote 1.0.28", "syn 2.0.18", "wasm-bindgen-backend", @@ -3368,15 +3365,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -3384,7 +3381,7 @@ dependencies = [ [[package]] name = "websurfx" -version = "0.12.0" +version = "0.12.3" dependencies = [ "actix-files", "actix-web", @@ -3464,37 +3461,13 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a0b25fc..efd71eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "0.12.0" +version = "0.12.3" edition = "2021" description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind." repository = "https://github.com/neon-mmd/websurfx"