From 24fda29358f2d3ff75f30eaecd11f9a5c661ede8 Mon Sep 17 00:00:00 2001 From: Spandan Tripathy <128175097+CrypticRevenger@users.noreply.github.com> Date: Tue, 31 Oct 2023 23:02:51 +0530 Subject: [PATCH 01/39] =?UTF-8?q?=F0=9F=93=9D=20Typo=20and=20Grammatical?= =?UTF-8?q?=20correction=20in=20the=20documentation=20page=20(#366)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📝 docs: typo & grammatical correction under the `motivations` & `solutions` sections (#365) * 📝 docs: typo & grammatical correction under the `motivations` section (#365) * 🔖 chore: bump the app version (#365) * 🔖 chore: bump the app version (#365) --------- Co-authored-by: alamin655 --- Cargo.lock | 2 +- Cargo.toml | 2 +- docs/introduction.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 190501c..edce8d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4370,7 +4370,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "websurfx" -version = "1.2.15" +version = "1.2.16" dependencies = [ "actix-cors", "actix-files", diff --git a/Cargo.toml b/Cargo.toml index f1b5300..383b59e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.2.15" +version = "1.2.16" 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" diff --git a/docs/introduction.md b/docs/introduction.md index 7b540fb..690413c 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -4,10 +4,10 @@ A modern-looking, lightning-fast, privacy-respecting, secure [meta search engine # Motivation -Most meta search engines tend to be slow, lack high level of customization and missing many features and all of them like security as they are written in unsafe languages like python, javascript, etc which tend to open a wide variety of vulnerabilities which can also sometimes pose a threat to privacy as sometimes this can be exploited and can be used to leveraged to leak out sensitive information which is never good. +Most meta search engines tend to be slow, lack a high level of customization, and miss many features, and all of them lack security as they are written in unsafe languages like Python, JavaScript, etc., which tend to open a wide variety of vulnerabilities, which can also sometimes pose a threat to privacy as sometimes this can be exploited and can be used to leak out sensitive information, which is never good. # Solution -Websurfx is a project which seeks to provide privacy, security, speed and all the features which the user wants. +Websurfx is a project that seeks to provide privacy, security, speed, and all the features that the user wants. [⬅️ Go back to Home](./README.md) From 68f701265ffddad8b74f44722547c0727721e7f9 Mon Sep 17 00:00:00 2001 From: Spandan Tripathy <128175097+CrypticRevenger@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:28:43 +0530 Subject: [PATCH 02/39] =?UTF-8?q?=F0=9F=93=9D=20More=20typo=20correction?= =?UTF-8?q?=20and=20Grammatical=20correction=20in=20the=20documentation=20?= =?UTF-8?q?page=20(#368)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/configuration.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 7bfdfc9..cae0dfc 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -2,14 +2,14 @@ ## Installed From Source -If you have built `websurfx` from source then the configuration file will be located under project directory (codebase) at `websurfx/` +If you have built `websurfx` from the source then the configuration file will be located under the project directory (codebase) at `websurfx/` > **Note** -> If you have built websurfx with unstable/rolling/edge branch then you can copy the configuration file from `websurfx/config.lua` located under project directory (codebase) to `~/.config/websurfx/` and make the changes there and rerun the websurfx server. _This is only available from unstable/rolling/edge version_. +> If you have built websurfx with an unstable/rolling/edge branch then you can copy the configuration file from `websurfx/config.lua` located under the project directory (codebase) to `~/.config/websurfx/` and make the changes there and rerun the websurfx server. _This is only available from unstable/rolling/edge version_. ## Installed From Package -If you have installed `websurfx` using the package manager of your Linux distro then the default configuration file will be located at `/etc/xdg/websurfx/`. You can copy the default config to `~/.config/websurfx/` and make the changes there and rerun the websurfx server. +If you have installed `websurfx` using the package manager of your Linux distro then the default configuration file will be located at `/etc/xdg/websurfx/`. You can copy the default config to `~/.config/websurfx/` make the changes there and rerun the websurfx server. Some of the configuration options provided in the file are stated below. These are subdivided into the following categories: @@ -42,13 +42,13 @@ Some of the configuration options provided in the file are stated below. These a > > - Level 0 - With this level no search filtering occurs. > - Level 1 - With this level some search filtering occurs. -> - Level 2 - With this level the upstream search engines are restricted to send sensitive contents like NSFW search results, etc. -> - Level 3 - With this level the regex based filter lists is used alongside level 2 to filter more search results that have slipped in or custom results that needs to be filtered using the filter lists. -> - Level 4 - This level is similar to level 3 except in this level the regex based filter lists are used to disallow users to search sensitive or disallowed content. This level could be useful if you are parent or someone who wants to completely disallow their kids or yourself from watching sensitive content. +> - Level 2 - With this level the upstream search engines are restricted to sending sensitive content like NSFW search results, etc. +> - Level 3 - With this level the regex-based filter lists are used alongside level 2 to filter more search results that have slipped in or custom results that need to be filtered using the filter lists. +> - Level 4 - This level is similar to level 3 except in this level the regex-based filter lists are used to disallow users to search sensitive or disallowed content. This level could be useful if you are a parent or someone who wants to completely disallow their kids or yourself from watching sensitive content. ## Website -- **colorscheme:** The colorscheme name which should be used for the website theme (the name should be in accordance to the colorscheme file name present in `public/static/colorschemes` folder). +- **colorscheme:** The colorscheme name which should be used for the website theme (the name should be by the colorscheme file name present in the `public/static/colorschemes` folder). > By Default we provide 12 colorschemes to choose from these are: > @@ -65,7 +65,7 @@ Some of the configuration options provided in the file are stated below. These a > 11. tokyo-night > 12. tomorrow-night -- **theme:** The theme name which should be used for the website (again, the name should be in accordance to the theme file name present in `public/static/themes` folder). +- **theme:** The theme name that should be used for the website (again, the name should be by the theme file name present in the `public/static/themes` folder). > By Default we provide 1 theme to choose from these are: > @@ -73,7 +73,7 @@ Some of the configuration options provided in the file are stated below. These a ## Cache -- **redis_url:** Redis connection url address on which the client should connect on. +- **redis_url:** Redis connection URL address on which the client should connect. > **Note** > This option can be commented out if you have compiled the app without the `redis-cache` feature. For more information, See [**building**](./building.md). From 9d070141ffdd23c5a6952ae4fdf37a90f8743b2e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:57:25 +0000 Subject: [PATCH 03/39] build(deps): bump peter-evans/create-pull-request from 4.2.4 to 5.0.2 (#369) --- .github/workflows/contributors.yml | 2 +- .github/workflows/mega-linter.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 75aecf3..d665006 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -32,7 +32,7 @@ jobs: noCommit: true - name: Commit & PR - uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # v4.2.4 + uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 with: token: ${{ secrets.GITHUB_TOKEN }} add-paths: .github/assets/CONTRIBUTORS.svg diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 02bdaac..3fae23e 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -63,7 +63,7 @@ jobs: - name: Create Pull Request with applied fixes id: cpr if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@v5.0.2 with: token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} commit-message: "[MegaLinter] Apply linters automatic fixes" From 4dd455e1851b1d585153fb4f7f5ef74ee2201bc4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:06:53 +0000 Subject: [PATCH 04/39] build(deps): bump stefanzweifel/git-auto-commit-action from 4 to 5 (#371) --- .github/workflows/mega-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 3fae23e..3927832 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -81,7 +81,7 @@ jobs: run: sudo chown -Rc $UID .git/ - name: Commit and push applied linter fixes if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }} commit_message: "[MegaLinter] Apply linters fixes" From 2e0def777cf73e8593ef51f71696d7c620c5c7fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:15:48 +0000 Subject: [PATCH 05/39] build(deps): bump actix-governor from 0.4.1 to 0.5.0 (#372) --- Cargo.lock | 32 +++++++++++++------------------- Cargo.toml | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index edce8d5..580b530 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,9 +59,9 @@ dependencies = [ [[package]] name = "actix-governor" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46ff2d40f2bc627b8054c5e20fa6b0b0cf9428699b54bd41634e9ae3098ad555" +checksum = "a2e7b88f3804e01bd4191fdb08650430bbfcb43d3d9b2890064df3551ec7d25b" dependencies = [ "actix-http", "actix-web", @@ -1413,7 +1413,7 @@ checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -1430,9 +1430,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "governor" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c390a940a5d157878dd057c78680a33ce3415bcd05b4799509ea44210914b4d5" +checksum = "821239e5672ff23e2a7060901fa622950bbd80b649cdaadd78d1c1767ed14eb4" dependencies = [ "cfg-if 1.0.0", "dashmap", @@ -1965,10 +1965,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] -name = "mach" -version = "0.3.2" +name = "mach2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" dependencies = [ "libc", ] @@ -2142,7 +2142,7 @@ checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys", ] @@ -2751,16 +2751,16 @@ dependencies = [ [[package]] name = "quanta" -version = "0.9.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20afe714292d5e879d8b12740aa223c6a88f118af41870e8b6196e39a02238a8" +checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" dependencies = [ "crossbeam-utils 0.8.16", "libc", - "mach", + "mach2", "once_cell", "raw-cpuid", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", "web-sys", "winapi 0.3.9", ] @@ -4274,12 +4274,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index 383b59e..fce56de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ futures = {version="0.3.28"} dhat = {version="0.3.2", optional = true} mimalloc = { version = "0.1.38", default-features = false } async-once-cell = {version="0.5.3"} -actix-governor = {version="0.4.1"} +actix-governor = {version="0.5.0"} mini-moka = { version="0.10", optional = true} [dev-dependencies] From 42f0dc1bc7674007c09cc38792fd0ba3a82c151d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:23:25 +0000 Subject: [PATCH 06/39] build(deps): bump scraper from 0.17.1 to 0.18.1 (#373) --- Cargo.lock | 5 ++--- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 580b530..90f3f8e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3274,9 +3274,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scraper" -version = "0.17.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95a930e03325234c18c7071fd2b60118307e025d6fff3e12745ffbf63a3d29c" +checksum = "585480e3719b311b78a573db1c9d9c4c1f8010c2dee4cc59c2efe58ea4dbc3e1" dependencies = [ "ahash 0.8.6", "cssparser 0.31.2", @@ -3285,7 +3285,6 @@ dependencies = [ "html5ever 0.26.0", "once_cell", "selectors", - "smallvec 1.11.1", "tendril", ] diff --git a/Cargo.toml b/Cargo.toml index fce56de..fa43660 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ reqwest = {version="0.11.21",default-features = false,features = ["json", "rustl tokio = {version="1.32.0",features=["rt-multi-thread","macros"]} serde = {version="1.0.188",features=["derive"]} handlebars = { version = "4.4.0", features = ["dir_source"] } -scraper = {version="0.17.1"} +scraper = {version="0.18.1"} actix-web = {version="4.4.0", features = ["cookies"]} actix-files = {version="0.6.2"} actix-cors = {version="0.6.4"} From 68a2b955d82ccbec14600d53f02a32d372a2ce3b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:40:07 +0000 Subject: [PATCH 07/39] build(deps): bump actions/setup-node from 3 to 4 (#370) --- .github/workflows/labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index e014b39..5a617e5 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '14' - uses: EddieHubCommunity/gh-action-open-source-labels@main From faf99959628a71c1d314c0c053720bdf4abaa3f2 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Fri, 3 Nov 2023 12:04:31 +0300 Subject: [PATCH 08/39] =?UTF-8?q?=F0=9F=A9=B9=20fix:=20remove=20unnecessar?= =?UTF-8?q?y=20`stylelint`=20checks=20by=20disabling=20them=20in=20the=20`?= =?UTF-8?q?stylelint`=20config=20file=20(#375)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .stylelintrc.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.stylelintrc.json b/.stylelintrc.json index 05ffdd4..cf4df56 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,9 +1,12 @@ -{ +{ "extends": "stylelint-config-standard", "rules": { "alpha-value-notation": "number", - "selector-class-pattern": null + "selector-class-pattern": null, + "no-descending-specificity": null }, + "fix": true, + "cache": true, "overrides": [ { "files": ["*.js"], From 66669a0cd82204d403b35fdc2d19eb25140e6ea0 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Fri, 3 Nov 2023 12:08:29 +0300 Subject: [PATCH 09/39] =?UTF-8?q?=F0=9F=94=96=20chore:=20bump=20the=20app?= =?UTF-8?q?=20version=20(#375)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 218 +++++++++++++++++++++++++---------------------------- Cargo.toml | 2 +- 2 files changed, 105 insertions(+), 115 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31ca578..257cef3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,7 +65,7 @@ checksum = "46ff2d40f2bc627b8054c5e20fa6b0b0cf9428699b54bd41634e9ae3098ad555" dependencies = [ "actix-http", "actix-web", - "futures 0.3.28", + "futures 0.3.29", "governor", ] @@ -248,9 +248,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72832d73be48bac96a5d7944568f305d829ed55b0ce3b483647089dfaf6cf704" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if 1.0.0", "getrandom", @@ -424,9 +424,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da74e2b81409b1b743f8f0c62cc6254afefb8b8e50bbfe3735550f7aeefa3448" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -450,9 +450,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytecount" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1a12477b7237a01c11a80a51278165f9ba0edd28fa6db00a65ab230320dc58c" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" [[package]] name = "byteorder" @@ -479,9 +479,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "bytestring" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238e4886760d98c4f899360c834fa93e62cf7f721ac3c2da375cbdf4b8679aae" +checksum = "74d80203ea6b29df88012294f62733de21cfeab47f17b41af3a38bc30a03ee72" dependencies = [ "bytes 1.5.0", ] @@ -583,18 +583,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstyle", "clap_lex", @@ -602,9 +602,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "cloudabi" @@ -692,9 +692,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -1148,9 +1148,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -1163,9 +1163,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -1173,9 +1173,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-cpupool" @@ -1189,9 +1189,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -1200,15 +1200,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -1217,15 +1217,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-timer" @@ -1235,9 +1235,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -1310,7 +1310,7 @@ checksum = "c390a940a5d157878dd057c78680a33ce3415bcd05b4799509ea44210914b4d5" dependencies = [ "cfg-if 1.0.0", "dashmap", - "futures 0.3.28", + "futures 0.3.29", "futures-timer", "no-std-compat", "nonzero_ext", @@ -1558,9 +1558,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.9", @@ -1683,9 +1683,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -1736,9 +1736,9 @@ checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "local-channel" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a493488de5f18c8ffcba89eebb8532ffc562dc400490eb65b84893fae0b178" +checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" dependencies = [ "futures-core", "futures-sink", @@ -1747,9 +1747,9 @@ dependencies = [ [[package]] name = "local-waker" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1" +checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" [[package]] name = "lock_api" @@ -2106,9 +2106,9 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "a9dfc0783362704e97ef3bd24261995a699468440099ef95d869b4d9732f829a" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -2138,9 +2138,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "2f55da20b29f956fb01f0add8683eb26ee13ebe3ebd935e49898717c6b4b2830" dependencies = [ "cc", "libc", @@ -2217,9 +2217,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" dependencies = [ "memchr", "thiserror", @@ -2228,9 +2228,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8" +checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" dependencies = [ "pest", "pest_generator", @@ -2238,9 +2238,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a" +checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" dependencies = [ "pest", "pest_meta", @@ -2251,9 +2251,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d" +checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" dependencies = [ "once_cell", "pest", @@ -2719,7 +2719,7 @@ dependencies = [ "async-trait", "bytes 1.5.0", "combine", - "futures 0.3.28", + "futures 0.3.29", "futures-util", "itoa 1.0.9", "percent-encoding 2.3.0", @@ -2739,15 +2739,6 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -2862,17 +2853,16 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", "spin", "untrusted", - "web-sys", - "winapi 0.3.9", + "windows-sys", ] [[package]] @@ -2907,9 +2897,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.20" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", "errno", @@ -2920,9 +2910,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", "ring", @@ -2941,9 +2931,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring", "untrusted", @@ -3010,9 +3000,9 @@ dependencies = [ [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -3096,18 +3086,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -3116,9 +3106,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa 1.0.9", "ryu", @@ -3271,9 +3261,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "stable_deref_trait" @@ -3434,13 +3424,13 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if 1.0.0", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "rustix", "windows-sys", ] @@ -3741,9 +3731,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes 1.5.0", "futures-core", @@ -3871,9 +3861,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" @@ -3968,9 +3958,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3978,9 +3968,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", @@ -3993,9 +3983,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -4005,9 +3995,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote 1.0.33", "wasm-bindgen-macro-support", @@ -4015,9 +4005,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -4028,15 +4018,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -4050,7 +4040,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "websurfx" -version = "1.2.5" +version = "1.2.23" dependencies = [ "actix-cors", "actix-files", @@ -4063,7 +4053,7 @@ dependencies = [ "env_logger", "error-stack", "fake-useragent", - "futures 0.3.28", + "futures 0.3.29", "handlebars", "log", "md5", @@ -4235,18 +4225,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.11" +version = "0.7.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c19fae0c8a9efc6a8281f2e623db8af1db9e57852e04cde3e754dd2dc29340f" +checksum = "e50cbb27c30666a6108abd6bc7577556265b44f243e2be89a8bc4e07a528c107" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.11" +version = "0.7.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc56589e9ddd1f1c28d4b4b5c773ce232910a6bb67a70133d61c9e347585efe9" +checksum = "a25f293fe55f0a48e7010d65552bb63704f6ceb55a1a385da10d41d8f78e4a3d" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", diff --git a/Cargo.toml b/Cargo.toml index b4fac59..0d7e277 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.2.5" +version = "1.2.23" 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 bbc226829ed6fdc2599b9fe8474326067260d7e6 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Fri, 3 Nov 2023 12:41:13 +0300 Subject: [PATCH 10/39] =?UTF-8?q?=F0=9F=9A=A8=20chore:=20make=20build=20an?= =?UTF-8?q?d=20clippy=20checks=20happy=20(#375)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c828a4d..35acf27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -248,7 +248,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ @@ -724,7 +724,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" dependencies = [ - "time 0.1.43", + "time 0.1.45", "url 1.7.2", ] @@ -752,7 +752,7 @@ dependencies = [ "publicsuffix", "serde", "serde_json", - "time 0.1.43", + "time 0.1.45", "try_from", "url 1.7.2", ] @@ -1413,7 +1413,7 @@ checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1659,7 +1659,7 @@ dependencies = [ "log", "net2", "rustc_version 0.2.3", - "time 0.1.43", + "time 0.1.45", "tokio 0.1.22", "tokio-buf", "tokio-executor", @@ -2142,7 +2142,7 @@ checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", ] @@ -2760,7 +2760,7 @@ dependencies = [ "mach2", "once_cell", "raw-cpuid", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "web-sys", "winapi 0.3.9", ] @@ -3063,7 +3063,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded 0.5.5", - "time 0.1.43", + "time 0.1.45", "tokio 0.1.22", "tokio-executor", "tokio-io", @@ -3800,11 +3800,12 @@ checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" [[package]] name = "time" -version = "0.1.43" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi 0.3.9", ] @@ -4273,6 +4274,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" From 3aee141d0eb1d565bfc4375772eb48c12e14d308 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Wed, 8 Nov 2023 19:01:38 +0300 Subject: [PATCH 11/39] =?UTF-8?q?=E2=9E=96=20build:=20remove=20unneeded=20?= =?UTF-8?q?features=20&=20remove=20the=20rand=20crate=20(#380)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 59 +++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f1c6f38..56d96a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,41 +13,40 @@ bench = false path = "src/bin/websurfx.rs" [dependencies] -reqwest = {version="0.11.21",default-features = false,features = ["json", "rustls-tls"]} -tokio = {version="1.32.0",features=["rt-multi-thread","macros"]} -serde = {version="1.0.188",features=["derive"]} -handlebars = { version = "4.4.0", features = ["dir_source"] } -scraper = {version="0.18.1"} -actix-web = {version="4.4.0", features = ["cookies"]} -actix-files = {version="0.6.2"} -actix-cors = {version="0.6.4"} -serde_json = {version="1.0.105"} -fake-useragent = {version="0.1.3"} -env_logger = {version="0.10.0"} -log = {version="0.4.20"} -mlua = {version="0.9.1", features=["luajit", "vendored"]} -redis = {version="0.23.3", features=["tokio-comp","connection-manager"], optional = true} -md5 = {version="0.7.0"} -rand={version="0.8.5"} -error-stack = {version="0.4.0"} -async-trait = {version="0.1.73"} -regex = {version="1.9.4", features=["perf"]} -smallvec = {version="1.11.0", features=["union", "serde"]} -futures = {version="0.3.28"} -dhat = {version="0.3.2", optional = true} +reqwest = {version="0.11.22", default-features=false, features=["rustls-tls"]} +tokio = {version="1.32.0",features=["rt-multi-thread","macros"], default-features = false} +serde = {version="1.0.190", default-features=false, features=["derive"]} +serde_json = {version="1.0.108", default-features=false} +handlebars = { version = "4.4.0", features = ["dir_source"], default-features = false } +scraper = {version="0.18.1", default-features = false} +actix-web = {version="4.4.0", features = ["cookies", "macros"], default-features=false} +actix-files = {version="0.6.2", default-features=false} +actix-cors = {version="0.6.4", default-features=false} +fake-useragent = {version="0.1.3", default-features=false} +env_logger = {version="0.10.0", default-features=false} +log = {version="0.4.20", default-features=false} +mlua = {version="0.9.1", features=["luajit", "vendored"], default-features=false} +redis = {version="0.23.3", features=["tokio-comp","connection-manager"], default-features = false, optional = true} +md5 = {version="0.7.0", default-features=false} +error-stack = {version="0.4.0", default-features=false, features=["std"]} +async-trait = {version="0.1.73", default-features=false} +regex = {version="1.9.4", features=["perf"], default-features = false} +smallvec = {version="1.11.0", features=["union", "serde"], default-features=false} +futures = {version="0.3.28", default-features=false} +dhat = {version="0.3.2", optional = true, default-features=false} mimalloc = { version = "0.1.38", default-features = false } -async-once-cell = {version="0.5.3"} -actix-governor = {version="0.5.0"} -mini-moka = { version="0.10", optional = true} +async-once-cell = {version="0.5.3", default-features=false} +actix-governor = {version="0.5.0", default-features=false} +mini-moka = { version="0.10", optional = true, default-features=false, features=["sync"]} [dev-dependencies] -rusty-hook = "^0.11.2" -criterion = "0.5.1" -tempfile = "3.8.0" +rusty-hook = {version="^0.11.2", default-features=false} +criterion = {version="0.5.1", default-features=false} +tempfile = {version="3.8.0", default-features=false} [build-dependencies] -lightningcss = "1.0.0-alpha.50" -minify-js = "0.5.6" +lightningcss = {version="1.0.0-alpha.50", default-features=false, features=["grid"]} +minify-js = {version="0.5.6", default-features=false} [profile.dev] opt-level = 0 From 89ee79cd0f4e9da14734efe4a2439a79ff4a740d Mon Sep 17 00:00:00 2001 From: neon_arch Date: Wed, 8 Nov 2023 19:04:57 +0300 Subject: [PATCH 12/39] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20build:=20improve=20n?= =?UTF-8?q?on-release=20build=20time=20by=20changing=20the=20dev=20profile?= =?UTF-8?q?=20build=20flag=20(#380)?= 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 56d96a2..c73756d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ minify-js = {version="0.5.6", default-features=false} [profile.dev] opt-level = 0 debug = true -split-debuginfo = '...' +split-debuginfo = 'unpacked' debug-assertions = true overflow-checks = true lto = false From 3742893c1918d7c9bc3f340f254895f406d8d8b3 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Wed, 8 Nov 2023 19:09:50 +0300 Subject: [PATCH 13/39] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20refactor:=20reimp?= =?UTF-8?q?lement=20the=20random=20delay=20code=20without=20the=20rand=20c?= =?UTF-8?q?rate=20(#380)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/results/aggregator.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/results/aggregator.rs b/src/results/aggregator.rs index 18fdb92..b57768f 100644 --- a/src/results/aggregator.rs +++ b/src/results/aggregator.rs @@ -8,8 +8,8 @@ use crate::models::{ engine_models::{EngineError, EngineHandler}, }; use error_stack::Report; -use rand::Rng; use regex::Regex; +use std::time::{SystemTime, UNIX_EPOCH}; use std::{ collections::HashMap, io::{BufReader, Read}, @@ -72,9 +72,9 @@ pub async fn aggregate( // Add a random delay before making the request. if random_delay || !debug { - let mut rng = rand::thread_rng(); - let delay_secs = rng.gen_range(1..10); - tokio::time::sleep(Duration::from_secs(delay_secs)).await; + let nanos = SystemTime::now().duration_since(UNIX_EPOCH)?.subsec_nanos() as f32; + let delay = ((nanos / 1_0000_0000 as f32).floor() as u64) + 1; + tokio::time::sleep(Duration::from_secs(delay)).await; } let mut names: Vec<&str> = Vec::with_capacity(0); From ad514398fa1e102fff27286d267affafb7e4fd3d Mon Sep 17 00:00:00 2001 From: neon_arch Date: Wed, 8 Nov 2023 19:12:16 +0300 Subject: [PATCH 14/39] =?UTF-8?q?=F0=9F=94=96=20chore:=20bump=20the=20app?= =?UTF-8?q?=20version=20(#380)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 475 +++++------------------------------------------------ Cargo.toml | 2 +- 2 files changed, 45 insertions(+), 432 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 35acf27..869b604 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,14 +82,11 @@ dependencies = [ "ahash 0.8.6", "base64 0.21.5", "bitflags 2.4.1", - "brotli", "bytes 1.5.0", "bytestring", "derive_more", "encoding_rs", - "flate2", "futures-core", - "h2 0.3.21", "http 0.2.9", "httparse", "httpdate", @@ -105,7 +102,6 @@ dependencies = [ "tokio 1.33.0", "tokio-util", "tracing", - "zstd", ] [[package]] @@ -115,7 +111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -228,7 +224,7 @@ dependencies = [ "actix-router", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -288,21 +284,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - [[package]] name = "anes" version = "0.1.6" @@ -347,7 +328,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -395,15 +376,6 @@ version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" -[[package]] -name = "base64-simd" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" -dependencies = [ - "simd-abstraction", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -431,18 +403,6 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -452,27 +412,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "brotli" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - [[package]] name = "bstr" version = "1.7.0" @@ -489,28 +428,6 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" -[[package]] -name = "bytecheck" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" -dependencies = [ - "proc-macro2 1.0.69", - "quote 1.0.33", - "syn 1.0.109", -] - [[package]] name = "bytecount" version = "0.6.7" @@ -592,7 +509,6 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "jobserver", "libc", ] @@ -807,8 +723,6 @@ dependencies = [ "num-traits", "once_cell", "oorandom", - "plotters", - "rayon", "regex", "serde", "serde_derive", @@ -843,22 +757,11 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" dependencies = [ - "crossbeam-epoch 0.8.2", + "crossbeam-epoch", "crossbeam-utils 0.7.2", "maybe-uninit", ] -[[package]] -name = "crossbeam-deque" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch 0.9.15", - "crossbeam-utils 0.8.16", -] - [[package]] name = "crossbeam-epoch" version = "0.8.2" @@ -870,20 +773,7 @@ dependencies = [ "crossbeam-utils 0.7.2", "lazy_static", "maybe-uninit", - "memoffset 0.5.6", - "scopeguard", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" -dependencies = [ - "autocfg 1.1.0", - "cfg-if 1.0.0", - "crossbeam-utils 0.8.16", - "memoffset 0.9.0", + "memoffset", "scopeguard", ] @@ -970,7 +860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -992,15 +882,6 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" -[[package]] -name = "data-url" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" -dependencies = [ - "matches", -] - [[package]] name = "deranged" version = "0.3.9" @@ -1097,11 +978,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" dependencies = [ - "humantime", - "is-terminal", "log", - "regex", - "termcolor", ] [[package]] @@ -1116,9 +993,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" dependencies = [ "libc", "windows-sys", @@ -1250,12 +1127,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futf" version = "0.1.5" @@ -1338,7 +1209,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1407,9 +1278,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if 1.0.0", "libc", @@ -1509,9 +1380,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.7", -] [[package]] name = "hashbrown" @@ -1635,12 +1503,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "hyper" version = "0.12.36" @@ -1811,15 +1673,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.65" @@ -1853,9 +1706,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libmimalloc-sys" @@ -1869,33 +1722,29 @@ dependencies = [ [[package]] name = "lightningcss" -version = "1.0.0-alpha.50" +version = "1.0.0-alpha.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2999490cc10a59ad8a87d731791a5d438d2d025e3f137aa7d4c23e1827985b0" +checksum = "99d6ad516c08b24c246b339159dc2ee2144c012e8ebdf4db4bddefb8734b2b69" dependencies = [ "ahash 0.7.7", "bitflags 2.4.1", "const-str", "cssparser 0.33.0", "cssparser-color", - "dashmap", "data-encoding", "itertools", "lazy_static", "parcel_selectors", - "parcel_sourcemap", "paste", "pathdiff", - "rayon", - "serde", "smallvec 1.11.1", ] [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "local-channel" @@ -2037,15 +1886,6 @@ dependencies = [ "autocfg 1.1.0", ] -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "mimalloc" version = "0.1.39" @@ -2279,9 +2119,9 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "openssl" -version = "0.10.58" +version = "0.10.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9dfc0783362704e97ef3bd24261995a699468440099ef95d869b4d9732f829a" +checksum = "7a257ad03cd8fb16ad4172fedf8094451e1af1c4b70097636ef2eac9a5f0cc33" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -2300,7 +2140,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2311,9 +2151,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.94" +version = "0.9.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f55da20b29f956fb01f0add8683eb26ee13ebe3ebd935e49898717c6b4b2830" +checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9" dependencies = [ "cc", "libc", @@ -2321,12 +2161,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "outref" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" - [[package]] name = "parcel_selectors" version = "0.26.4" @@ -2343,20 +2177,6 @@ dependencies = [ "smallvec 1.11.1", ] -[[package]] -name = "parcel_sourcemap" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485b74d7218068b2b7c0e3ff12fbc61ae11d57cb5d8224f525bd304c6be05bbb" -dependencies = [ - "base64-simd", - "data-url", - "rkyv", - "serde", - "serde_json", - "vlq", -] - [[package]] name = "parking_lot" version = "0.9.0" @@ -2474,7 +2294,7 @@ dependencies = [ "pest_meta", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2576,7 +2396,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2623,7 +2443,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2644,34 +2464,6 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" -[[package]] -name = "plotters" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" - -[[package]] -name = "plotters-svg" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" -dependencies = [ - "plotters-backend", -] - [[package]] name = "powerfmt" version = "0.2.0" @@ -2708,26 +2500,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2 1.0.69", - "quote 1.0.33", - "syn 1.0.109", -] - [[package]] name = "publicsuffix" version = "1.5.6" @@ -2783,12 +2555,6 @@ dependencies = [ "proc-macro2 1.0.69", ] -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - [[package]] name = "rand" version = "0.6.5" @@ -2934,26 +2700,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "rayon" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" -dependencies = [ - "crossbeam-deque 0.8.3", - "crossbeam-utils 0.8.16", -] - [[package]] name = "rdrand" version = "0.4.0" @@ -2979,8 +2725,6 @@ dependencies = [ "percent-encoding 2.3.0", "pin-project-lite", "ryu", - "sha1_smol", - "socket2 0.4.10", "tokio 1.33.0", "tokio-retry", "tokio-util", @@ -3031,15 +2775,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" -[[package]] -name = "rend" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" -dependencies = [ - "bytecheck", -] - [[package]] name = "reqwest" version = "0.9.24" @@ -3070,7 +2805,7 @@ dependencies = [ "tokio-threadpool", "tokio-timer", "url 1.7.2", - "uuid 0.7.4", + "uuid", "winreg 0.6.2", ] @@ -3128,34 +2863,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "rkyv" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" -dependencies = [ - "bitvec", - "bytecheck", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid 1.5.0", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" -dependencies = [ - "proc-macro2 1.0.69", - "quote 1.0.33", - "syn 1.0.109", -] - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -3281,7 +2988,6 @@ dependencies = [ "ahash 0.8.6", "cssparser 0.31.2", "ego-tree", - "getopts", "html5ever 0.26.0", "once_cell", "selectors", @@ -3298,12 +3004,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "security-framework" version = "2.9.2" @@ -3382,22 +3082,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3455,12 +3155,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sha1_smol" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" - [[package]] name = "sha2" version = "0.10.8" @@ -3481,21 +3175,6 @@ dependencies = [ "libc", ] -[[package]] -name = "simd-abstraction" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" -dependencies = [ - "outref", -] - -[[package]] -name = "simdutf8" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - [[package]] name = "siphasher" version = "0.2.3" @@ -3675,9 +3354,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -3733,12 +3412,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "tempfile" version = "3.8.1" @@ -3763,15 +3436,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "termcolor" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" version = "1.0.50" @@ -3789,7 +3453,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3951,7 +3615,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4024,7 +3688,7 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" dependencies = [ - "crossbeam-deque 0.7.4", + "crossbeam-deque", "crossbeam-queue", "crossbeam-utils 0.7.2", "futures 0.1.31", @@ -4220,12 +3884,6 @@ dependencies = [ "rand 0.6.5", ] -[[package]] -name = "uuid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" - [[package]] name = "vcpkg" version = "0.2.15" @@ -4238,12 +3896,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "vlq" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65dd7eed29412da847b0f78bcec0ac98588165988a8cfe41d4ea1d429f8ccfff" - [[package]] name = "walkdir" version = "2.4.0" @@ -4307,7 +3959,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -4341,7 +3993,7 @@ checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4370,7 +4022,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "websurfx" -version = "1.2.23" +version = "1.2.24" dependencies = [ "actix-cors", "actix-files", @@ -4392,7 +4044,6 @@ dependencies = [ "mini-moka", "minify-js", "mlua", - "rand 0.8.5", "redis", "regex", "reqwest 0.11.22", @@ -4555,60 +4206,22 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "zerocopy" -version = "0.7.23" +version = "0.7.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e50cbb27c30666a6108abd6bc7577556265b44f243e2be89a8bc4e07a528c107" +checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.23" +version = "0.7.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a25f293fe55f0a48e7010d65552bb63704f6ceb55a1a385da10d41d8f78e4a3d" +checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.38", -] - -[[package]] -name = "zstd" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "6.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", + "syn 2.0.39", ] diff --git a/Cargo.toml b/Cargo.toml index c73756d..4c2a812 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.2.23" +version = "1.2.24" 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 0facfdbd56cea32723a8d89bf0f1aed7f3aea9f0 Mon Sep 17 00:00:00 2001 From: will <64425242+willser@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:35:52 +0800 Subject: [PATCH 15/39] =?UTF-8?q?=F0=9F=93=9D=20Additional=20commands=20re?= =?UTF-8?q?quired=20for=20the=20setup=20of=20the=20local=20development=20e?= =?UTF-8?q?nvironment=20(#379)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Add additional commands in developing.md * Update docs/developing.md Co-authored-by: neon_arch * Update developing.md * 🔖 chore: bump the app version (#379) * 🔖 chore: bump the app version (#379) --------- Co-authored-by: neon_arch Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: alamin655 --- Cargo.lock | 2 +- Cargo.toml | 2 +- docs/developing.md | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 869b604..6c308b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4022,7 +4022,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "websurfx" -version = "1.2.24" +version = "1.2.25" dependencies = [ "actix-cors", "actix-files", diff --git a/Cargo.toml b/Cargo.toml index 4c2a812..82e88b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.2.24" +version = "1.2.25" 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" diff --git a/docs/developing.md b/docs/developing.md index 831809d..c8752e6 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -50,10 +50,11 @@ Before you start working on the project. You will need the following packages in - The latest version of `cargo` installed on your system which is required to manage building and running the project. The installation instructions for this can be found [here](https://doc.rust-lang.org/cargo/getting-started/installation.html). - The latest version of `npm` installed on your system which is required to allow the installation of other tools necessary for the project. The installation for this can be found [here](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm). - The latest version of `redis` installed on your system which will be used to avoid introducing unexpected issues when working on the project. The installation for this can be found [here](https://redis.io/docs/getting-started/installation/). -- The latest version of `stylelint` should be installed on your system which will be used by the pre-commit checks to lint the code before a commit can be made to ensure better code quality. Before you install `stylelint` on your system, make sure you have `npm` installed on your system. To install `stylelint` run the following command: +- The latest version of `stylelint` should be installed on your system which will be used by the pre-commit checks to lint the code before a commit can be made to ensure better code quality. Before you install `stylelint` on your system, make sure you have `npm` installed on your system. To install `stylelint` and plugins run the following command: ```shell $ npm i -g stylelint +$ npm i -g stylelint stylelint-config-standard postcss-lit ``` > **Note** From beb5e6012a023f26c11013d0297aa39edd581270 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Fri, 17 Nov 2023 22:07:32 +0300 Subject: [PATCH 16/39] =?UTF-8?q?=E2=9E=95=20build:=20replace=20handlebars?= =?UTF-8?q?=20crate=20with=20maud=20crate=20(#302)?= 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 82e88b1..3df6855 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ reqwest = {version="0.11.22", default-features=false, features=["rustls-tls"]} tokio = {version="1.32.0",features=["rt-multi-thread","macros"], default-features = false} serde = {version="1.0.190", default-features=false, features=["derive"]} serde_json = {version="1.0.108", default-features=false} -handlebars = { version = "4.4.0", features = ["dir_source"], default-features = false } +maud = {version="0.25.0", default-features=false, features=["actix-web"]} scraper = {version="0.18.1", default-features = false} actix-web = {version="4.4.0", features = ["cookies", "macros"], default-features=false} actix-files = {version="0.6.2", default-features=false} From 0ec89146c847ab57493e85c3f4acf993d7fe6f31 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Fri, 17 Nov 2023 22:10:06 +0300 Subject: [PATCH 17/39] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20refactor(maud):?= =?UTF-8?q?=20rewrite=20the=20frontend=20code=20with=20maud=20html=20frame?= =?UTF-8?q?work=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/templates/404.html | 10 -- public/templates/about.html | 29 ----- public/templates/bar.html | 3 - public/templates/cookies_tab.html | 12 -- public/templates/engines_tab.html | 32 ----- public/templates/footer.html | 16 --- public/templates/general_tab.html | 13 -- public/templates/header.html | 16 --- public/templates/index.html | 8 -- public/templates/navbar.html | 6 - public/templates/search.html | 86 -------------- public/templates/search_bar.html | 36 ------ public/templates/settings.html | 22 ---- public/templates/user_interface_tab.html | 28 ----- src/templates/mod.rs | 4 + src/templates/partials/bar.rs | 12 ++ src/templates/partials/footer.rs | 24 ++++ src/templates/partials/header.rs | 26 ++++ src/templates/partials/mod.rs | 8 ++ src/templates/partials/navbar.rs | 15 +++ src/templates/partials/search_bar.rs | 64 ++++++++++ .../partials/settings_tabs/cookies.rs | 21 ++++ .../partials/settings_tabs/engines.rs | 35 ++++++ .../partials/settings_tabs/general.rs | 23 ++++ src/templates/partials/settings_tabs/mod.rs | 6 + .../partials/settings_tabs/user_interface.rs | 48 ++++++++ src/templates/views/about.rs | 39 ++++++ src/templates/views/index.rs | 19 +++ src/templates/views/mod.rs | 7 ++ src/templates/views/not_found.rs | 20 ++++ src/templates/views/search.rs | 111 ++++++++++++++++++ src/templates/views/settings.rs | 45 +++++++ 32 files changed, 527 insertions(+), 317 deletions(-) delete mode 100644 public/templates/404.html delete mode 100644 public/templates/about.html delete mode 100644 public/templates/bar.html delete mode 100644 public/templates/cookies_tab.html delete mode 100644 public/templates/engines_tab.html delete mode 100644 public/templates/footer.html delete mode 100644 public/templates/general_tab.html delete mode 100644 public/templates/header.html delete mode 100644 public/templates/index.html delete mode 100644 public/templates/navbar.html delete mode 100644 public/templates/search.html delete mode 100644 public/templates/search_bar.html delete mode 100644 public/templates/settings.html delete mode 100644 public/templates/user_interface_tab.html create mode 100644 src/templates/mod.rs create mode 100644 src/templates/partials/bar.rs create mode 100644 src/templates/partials/footer.rs create mode 100644 src/templates/partials/header.rs create mode 100644 src/templates/partials/mod.rs create mode 100644 src/templates/partials/navbar.rs create mode 100644 src/templates/partials/search_bar.rs create mode 100644 src/templates/partials/settings_tabs/cookies.rs create mode 100644 src/templates/partials/settings_tabs/engines.rs create mode 100644 src/templates/partials/settings_tabs/general.rs create mode 100644 src/templates/partials/settings_tabs/mod.rs create mode 100644 src/templates/partials/settings_tabs/user_interface.rs create mode 100644 src/templates/views/about.rs create mode 100644 src/templates/views/index.rs create mode 100644 src/templates/views/mod.rs create mode 100644 src/templates/views/not_found.rs create mode 100644 src/templates/views/search.rs create mode 100644 src/templates/views/settings.rs diff --git a/public/templates/404.html b/public/templates/404.html deleted file mode 100644 index a8a9ac7..0000000 --- a/public/templates/404.html +++ /dev/null @@ -1,10 +0,0 @@ -{{>header this}} -
- Image of broken robot. -
-

Aw! snap

-

404 Page Not Found!

-

Go to search page

-
-
-{{>footer}} diff --git a/public/templates/about.html b/public/templates/about.html deleted file mode 100644 index 9c4cbb0..0000000 --- a/public/templates/about.html +++ /dev/null @@ -1,29 +0,0 @@ -{{>header this}} -
-
-
-

Websurfx

-
-
-

A modern-looking, lightning-fast, privacy-respecting, secure meta search engine written in Rust. It provides a fast and secure search experience while respecting user privacy.
It aggregates results from multiple search engines and presents them in an unbiased manner, filtering out trackers and ads. -

- -

Some of the Top Features:

- -
    Lightning fast - Results load within milliseconds for an instant search experience.
- -
    Secure search - All searches are performed over an encrypted connection to prevent snooping.
- -
    Ad free results - All search results are ad free and clutter free for a clean search experience.
- -
    Privacy focused - Websurface does not track, store or sell your search data. Your privacy is our priority.
- -
    Free and Open source - The entire project's code is open source and available for free on GitHub under an GNU Affero General Public License.
- -
    Highly customizable - Websurface comes with 9 built-in color themes and supports creating custom themes effortlessly.
-
- -

Devoloped by: Websurfx team

-
-{{>footer}} - diff --git a/public/templates/bar.html b/public/templates/bar.html deleted file mode 100644 index 489b075..0000000 --- a/public/templates/bar.html +++ /dev/null @@ -1,3 +0,0 @@ - - - -{{>footer}} diff --git a/public/templates/navbar.html b/public/templates/navbar.html deleted file mode 100644 index c369739..0000000 --- a/public/templates/navbar.html +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/public/templates/search.html b/public/templates/search.html deleted file mode 100644 index c6c9d6a..0000000 --- a/public/templates/search.html +++ /dev/null @@ -1,86 +0,0 @@ -{{>header this.style}} -
- {{>search_bar this}} -
- {{#if results}} {{#each results}} -
-

{{{this.title}}}

- {{{this.url}}} -

{{{this.description}}}

-
- {{#each engine}} - {{{this}}} - {{/each}} -
-
- {{/each}} {{else}} {{#if disallowed}} -
-
-

- Your search - {{{this.pageQuery}}} - - has been disallowed. -

-

Dear user,

-

- The query - {{{this.pageQuery}}} - has - been blacklisted via server configuration and hence disallowed by the - server. Henceforth no results could be displayed for your query. -

-
- Image of a Barricade -
- {{else}} {{#if filtered}} -
-
-

- Your search - {{{this.pageQuery}}} - - has been filtered. -

-

Dear user,

-

- All the search results contain results that has been configured to be - filtered out via server configuration and henceforth has been - completely filtered out. -

-
- Image of a paper inside a funnel -
- {{else}} {{#if noEnginesSelected}} -
-
-

- No results could be fetched for your search "{{{this.pageQuery}}}" . -

-

Dear user,

-

- No results could be retrieved from the upstream search engines as no - upstream search engines were selected from the settings page. -

-
- Image of a white cross inside a red circle -
- {{else}} -
-

Your search - {{{this.pageQuery}}} - did not match any documents.

-

Suggestions:

-
    -
  • Make sure that all words are spelled correctly.
  • -
  • Try different keywords.
  • -
  • Try more general keywords.
  • -
- Man fishing gif -
- {{/if}} {{/if}} {{/if}} {{/if}} -
- -
- - - - -{{>footer}} diff --git a/public/templates/search_bar.html b/public/templates/search_bar.html deleted file mode 100644 index a006d89..0000000 --- a/public/templates/search_bar.html +++ /dev/null @@ -1,36 +0,0 @@ -
- {{>bar this}} -
- {{#if engineErrorsInfo}} - - - {{else}} - - - {{/if}} -
-
-
- -
- diff --git a/public/templates/settings.html b/public/templates/settings.html deleted file mode 100644 index 3c97213..0000000 --- a/public/templates/settings.html +++ /dev/null @@ -1,22 +0,0 @@ -{{>header this}} -
-

Settings

-
-
- -
- {{> general_tab}} {{> user_interface_tab}} {{> engines_tab}} {{> - cookies_tab}} -

- -
-
-
- - -{{>footer}} diff --git a/public/templates/user_interface_tab.html b/public/templates/user_interface_tab.html deleted file mode 100644 index 7de0f06..0000000 --- a/public/templates/user_interface_tab.html +++ /dev/null @@ -1,28 +0,0 @@ -
-

User Interface

-

select theme

-

- Select the theme from the available themes to be used in user interface -

- -

select color scheme

-

- Select the color scheme for your theme to be used in user interface -

- -
diff --git a/src/templates/mod.rs b/src/templates/mod.rs new file mode 100644 index 0000000..cddec20 --- /dev/null +++ b/src/templates/mod.rs @@ -0,0 +1,4 @@ +//! + +mod partials; +pub mod views; diff --git a/src/templates/partials/bar.rs b/src/templates/partials/bar.rs new file mode 100644 index 0000000..da6939d --- /dev/null +++ b/src/templates/partials/bar.rs @@ -0,0 +1,12 @@ +//! + +use maud::{html, Markup,PreEscaped}; + +/// +pub fn bar(query: &str) -> Markup { + html!( + (PreEscaped("
")) + input type="search" name="search-box" value=(query) placeholder="Type to search"; + button type="submit" onclick="searchWeb()"{"search"} + ) +} diff --git a/src/templates/partials/footer.rs b/src/templates/partials/footer.rs new file mode 100644 index 0000000..c35aa4f --- /dev/null +++ b/src/templates/partials/footer.rs @@ -0,0 +1,24 @@ +//! + +use maud::{html, Markup, PreEscaped}; + +/// +pub fn footer() -> Markup { + html!( + footer{ + div{ + span{"Powered By "b{"Websurfx"}}span{"-"}span{"a lightening fast, privacy respecting, secure meta + search engine"} + } + div{ + ul{ + li{a href="https://github.com/neon-mmd/websurfx"{"Source Code"}} + li{a href="https://github.com/neon-mmd/websurfx/issues"{"Issues/Bugs"}} + } + } + } + script src="static/settings.js"{} + (PreEscaped("")) + (PreEscaped("")) + ) +} diff --git a/src/templates/partials/header.rs b/src/templates/partials/header.rs new file mode 100644 index 0000000..6b0c60f --- /dev/null +++ b/src/templates/partials/header.rs @@ -0,0 +1,26 @@ +//! + +use crate::templates::partials::navbar::navbar; +use maud::{html, Markup, PreEscaped, DOCTYPE}; + +/// +pub fn header(colorscheme: &str, theme: &str) -> Markup { + html!( + (DOCTYPE) + html lang="en" + + head{ + title{"Websurfx"} + meta charset="UTF-8"; + meta name="viewport" content="width=device-width, initial-scale=1"; + link href=(format!("static/colorschemes/{colorscheme}.css")) rel="stylesheet" type="text/css"; + link href=(format!("static/themes/{theme}.css")) rel="stylesheet" type="text/css"; + } + + (PreEscaped("")) + header{ + h1{a href="/"{"Websurfx"}} + (navbar()) + } + ) +} diff --git a/src/templates/partials/mod.rs b/src/templates/partials/mod.rs new file mode 100644 index 0000000..3635d80 --- /dev/null +++ b/src/templates/partials/mod.rs @@ -0,0 +1,8 @@ +//! + +pub mod footer; +pub mod header; +pub mod navbar; +pub mod bar; +pub mod settings_tabs; +pub mod search_bar; diff --git a/src/templates/partials/navbar.rs b/src/templates/partials/navbar.rs new file mode 100644 index 0000000..812ca5c --- /dev/null +++ b/src/templates/partials/navbar.rs @@ -0,0 +1,15 @@ +//! + +use maud::{html, Markup}; + +/// +pub fn navbar() -> Markup { + html!( + nav{ + ul{ + li{a href="about"{"about"}} + li{a href="settings"{"settings"}} + } + } + ) +} diff --git a/src/templates/partials/search_bar.rs b/src/templates/partials/search_bar.rs new file mode 100644 index 0000000..b1eb48f --- /dev/null +++ b/src/templates/partials/search_bar.rs @@ -0,0 +1,64 @@ +//! + +use maud::{html, Markup, PreEscaped}; + +use crate::{models::aggregation_models::EngineErrorInfo, templates::partials::bar::bar}; + +const SAFE_SEARCH_LEVELS_NAME: [&str; 3] = ["None", "Low", "Moderate"]; + +/// +pub fn search_bar( + engine_errors_info: &[EngineErrorInfo], + safe_search_level: u8, + query: &str, +) -> Markup { + html!( + .search_area{ + (bar(query)) + .error_box { + @if !engine_errors_info.is_empty(){ + button onclick="toggleErrorBox()" class="error_box_toggle_button"{ + img src="./images/warning.svg" alt="Info icon for error box"; + } + .dropdown_error_box{ + @for errors in engine_errors_info{ + .error_item{ + span class="engine_name"{(errors.engine)} + span class="engine_name"{(errors.error)} + span class="severity_color" style="background: {{{this.severity_color}}};"{} + } + } + } + } + @else { + button onclick="toggleErrorBox()" class="error_box_toggle_button"{ + img src="./images/info.svg" alt="Warning icon for error box"; + } + .dropdown_error_box { + .no_errors{ + "Everything looks good 🙂!!" + } + } + } + } + (PreEscaped("
")) + .search_options { + @if safe_search_level >= 3 { + (PreEscaped("")) + } + @for (idx, name) in SAFE_SEARCH_LEVELS_NAME.iter().enumerate() { + @if (safe_search_level as usize) == idx { + option value=(idx) selected {(format!("SafeSearch: {name}"))} + } + @else{ + option value=(idx) {(format!("SafeSearch: {name}"))} + } + } + (PreEscaped("")) + } + } + ) +} diff --git a/src/templates/partials/settings_tabs/cookies.rs b/src/templates/partials/settings_tabs/cookies.rs new file mode 100644 index 0000000..5b673b1 --- /dev/null +++ b/src/templates/partials/settings_tabs/cookies.rs @@ -0,0 +1,21 @@ +//! + +use maud::{html, Markup}; + +/// +pub fn cookies() -> Markup { + html!( + div class="cookies tab"{ + h1{"Cookies"} + p class="description"{ + "This is the cookies are saved on your system and it contains the preferences + you chose in the settings page" + } + input type="text" name="cookie_field" value="" readonly; + p class="description"{ + "The cookies stored are not used by us for any malicious intend or for + tracking you in any way." + } + } + ) +} diff --git a/src/templates/partials/settings_tabs/engines.rs b/src/templates/partials/settings_tabs/engines.rs new file mode 100644 index 0000000..1272926 --- /dev/null +++ b/src/templates/partials/settings_tabs/engines.rs @@ -0,0 +1,35 @@ +//! + +use maud::{html, Markup}; + +/// +pub fn engines(engine_names: &[&String]) -> Markup { + html!( + div class="engines tab"{ + h1{"Engines"} + h3{"select search engines"} + p class="description"{ + "Select the search engines from the list of engines that you want results from" + } + .engine_selection{ + .toggle_btn{ + label class="switch"{ + input type="checkbox" class="select_all" onchange="toggleAllSelection()"; + span class="slider round"{} + } + "Select All" + } + hr; + @for engine_name in engine_names{ + .toggle_btn{ + label class="switch"{ + input type="checkbox" class="engine"; + span class="slider round"{} + } + (format!("{}{}",engine_name[..1].to_uppercase().to_owned(), engine_name[1..].to_owned())) + } + } + } + } + ) +} diff --git a/src/templates/partials/settings_tabs/general.rs b/src/templates/partials/settings_tabs/general.rs new file mode 100644 index 0000000..06c4258 --- /dev/null +++ b/src/templates/partials/settings_tabs/general.rs @@ -0,0 +1,23 @@ +//! + +use maud::{html, Markup}; + +const SAFE_SEARCH_LEVELS: [(u8, &'static str); 3] = [(0, "None"), (1, "Low"), (2, "Moderate")]; + +/// +pub fn general() -> Markup { + html!( + div class="general tab active"{ + h1{"General"} + h3{"Select a safe search level"} + p class="description"{ + "Select a safe search level from the menu below to filter content based on the level." + } + select name="safe_search_levels"{ + @for (k,v) in SAFE_SEARCH_LEVELS{ + option value=(k){(v)} + } + } + } + ) +} diff --git a/src/templates/partials/settings_tabs/mod.rs b/src/templates/partials/settings_tabs/mod.rs new file mode 100644 index 0000000..ab73511 --- /dev/null +++ b/src/templates/partials/settings_tabs/mod.rs @@ -0,0 +1,6 @@ +//! + +pub mod general; +pub mod engines; +pub mod cookies; +pub mod user_interface; diff --git a/src/templates/partials/settings_tabs/user_interface.rs b/src/templates/partials/settings_tabs/user_interface.rs new file mode 100644 index 0000000..76580b9 --- /dev/null +++ b/src/templates/partials/settings_tabs/user_interface.rs @@ -0,0 +1,48 @@ +//! + +use crate::handler::paths::{file_path, FileType}; +use maud::{html, Markup}; +use std::fs::read_dir; + +fn style_option_list( + style_type: &str, +) -> Result, Box> { + let mut style_option_names: Vec<(String, String)> = Vec::new(); + for file in read_dir(format!( + "{}static/{}/", + file_path(FileType::Theme)?, + style_type, + ))? { + let style_name = file?.file_name().to_str().unwrap().replace(".css", ""); + style_option_names.push((style_name.clone(), style_name.replace("-", " "))); + } + + Ok(style_option_names) +} + +/// +pub fn user_interface() -> Result> { + Ok(html!( + div class="user_interface tab"{ + h1{"User Interface"} + h3{"select theme"} + p class="description"{ + "Select the theme from the available themes to be used in user interface" + } + select name="themes"{ + @for (k,v) in style_option_list("themes")?{ + option value=(k){(v)} + } + } + h3{"select color scheme"} + p class="description"{ + "Select the color scheme for your theme to be used in user interface" + } + select name="colorschemes"{ + @for (k,v) in style_option_list("colorschemes")?{ + option value=(k){(v)} + } + } + } + )) +} diff --git a/src/templates/views/about.rs b/src/templates/views/about.rs new file mode 100644 index 0000000..419187d --- /dev/null +++ b/src/templates/views/about.rs @@ -0,0 +1,39 @@ +//! + +use maud::{html, Markup}; + +use crate::templates::partials::{footer::footer, header::header}; + +/// +pub fn about(colorscheme: &str, theme: &str) -> Markup { + html!( + (header(colorscheme, theme)) + main class="about-container"{ + article { + div{ + h1{"Websurfx"} + hr size="4" width="100%" color="#a6e3a1"{} + } + p{"A modern-looking, lightning-fast, privacy-respecting, secure meta search engine written in Rust. It provides a fast and secure search experience while respecting user privacy."br{}" It aggregates results from multiple search engines and presents them in an unbiased manner, filtering out trackers and ads." + } + + h2{"Some of the Top Features:"} + + ul{strong{"Lightning fast "}"- Results load within milliseconds for an instant search experience."} + + ul{strong{"Secure search"}" - All searches are performed over an encrypted connection to prevent snooping."} + + ul{strong{"Ad free results"}" - All search results are ad free and clutter free for a clean search experience."} + + ul{strong{"Privacy focused"}" - Websurfx does not track, store or sell your search data. Your privacy is our priority."} + + ul{strong{"Free and Open source"}" - The entire project's code is open source and available for free on "{a href="https://github.com/neon-mmd/websurfx"{"GitHub"}}" under an GNU Affero General Public License."} + + ul{strong{"Highly customizable"}" - Websurfx comes with 9 built-in color themes and supports creating custom themes effortlessly."} + } + + h3{"Devoloped by: "{a href="https://github.com/neon-mmd/websurfx"{"Websurfx team"}}} + } + (footer()) + ) +} diff --git a/src/templates/views/index.rs b/src/templates/views/index.rs new file mode 100644 index 0000000..ae5acf8 --- /dev/null +++ b/src/templates/views/index.rs @@ -0,0 +1,19 @@ +//! + +use maud::{html, Markup, PreEscaped}; + +use crate::templates::partials::{bar::bar, footer::footer, header::header}; + +/// +pub fn index(colorscheme: &str, theme: &str, query: &str) -> Markup { + html!( + (header(colorscheme, theme)) + main class="search-container"{ + img src="../images/websurfx_logo.png" alt="Websurfx meta-search engine logo"; + (bar(query)) + (PreEscaped("")) + } + script src="static/index.js"{} + (footer()) + ) +} diff --git a/src/templates/views/mod.rs b/src/templates/views/mod.rs new file mode 100644 index 0000000..5093897 --- /dev/null +++ b/src/templates/views/mod.rs @@ -0,0 +1,7 @@ +//! + +pub mod about; +pub mod index; +pub mod not_found; +pub mod settings; +pub mod search; diff --git a/src/templates/views/not_found.rs b/src/templates/views/not_found.rs new file mode 100644 index 0000000..4f809b1 --- /dev/null +++ b/src/templates/views/not_found.rs @@ -0,0 +1,20 @@ +//! + +use crate::templates::partials::{footer::footer, header::header}; +use maud::{html, Markup}; + +/// +pub fn not_found(colorscheme: &str, theme: &str) -> Markup { + html!( + (header(colorscheme, theme)) + main class="error_container"{ + img src="images/robot-404.svg" alt="Image of broken robot."; + div class="error_content"{ + h1{"Aw! snap"} + h2{"404 Page Not Found!"} + p{"Go to "{a href="/"{"search page"}}} + } + } + (footer()) + ) +} diff --git a/src/templates/views/search.rs b/src/templates/views/search.rs new file mode 100644 index 0000000..90e8b0e --- /dev/null +++ b/src/templates/views/search.rs @@ -0,0 +1,111 @@ +//! + +use maud::{html, Markup, PreEscaped}; + +use crate::{ + models::aggregation_models::SearchResults, + templates::partials::{footer::footer, header::header, search_bar::search_bar}, +}; + +/// +pub fn search( + colorscheme: &str, + theme: &str, + query: &str, + search_results: &SearchResults, +) -> Markup { + html!( + (header(colorscheme, theme)) + main class="results"{ + (search_bar(&search_results.engine_errors_info, search_results.safe_search_level, query)) + .results_aggregated{ + @if !search_results.results.is_empty() { + @for result in search_results.results.iter(){ + .result { + h1{a href=(result.url){(PreEscaped(&result.title))}} + small{(result.url)} + p{(PreEscaped(&result.description))} + .upstream_engines{ + @for name in result.clone().engine{ + span{(name)} + } + } + } + } + } + @else if search_results.disallowed{ + .result_disallowed{ + .description{ + p{ + "Your search - "{span class="user_query"{(query)}}" - + has been disallowed." + } + p class="description_paragraph"{"Dear user,"} + p class="description_paragraph"{ + "The query - "{span class="user_query"{(query)}}" - has + been blacklisted via server configuration and hence disallowed by the + server. Henceforth no results could be displayed for your query." + } + } + img src="./images/barricade.png" alt="Image of a Barricade"; + } + } + @else if search_results.filtered { + .result_filtered{ + .description{ + p{ + "Your search - "{span class="user_query"{(query)}}" - + has been filtered." + } + p class="description_paragraph"{"Dear user,"} + p class="description_paragraph"{ + "All the search results contain results that has been configured to be + filtered out via server configuration and henceforth has been + completely filtered out." + } + } + img src="./images/filter.png" alt="Image of a paper inside a funnel"; + } + } + @else if search_results.no_engines_selected { + .result_engine_not_selected{ + .description{ + p{ + "No results could be fetched for your search '{span class="user_query"{(query)}}'." + } + p class="description_paragraph"{"Dear user,"} + p class="description_paragraph"{ + "No results could be retrieved from the upstream search engines as no + upstream search engines were selected from the settings page." + } + } + img src="./images/no_selection.png" alt="Image of a white cross inside a red circle"; + } + } + @else{ + .result_not_found { + p{"Your search - "{(query)}" - did not match any documents."} + p class="suggestions"{"Suggestions:"} + ul{ + li{"Make sure that all words are spelled correctly."} + li{"Try different keywords."} + li{"Try more general keywords."} + } + img src="./images/no_results.gif" alt="Man fishing gif"; + } + } + } + .page_navigation { + button type="button" onclick="navigate_backward()"{ + (PreEscaped("←")) "previous" + } + button type="button" onclick="navigate_forward()"{"next" (PreEscaped("→"))} + } + } + script src="static/index.js"{} + script src="static/search_area_options.js"{} + script src="static/pagination.js"{} + script src="static/error_box.js"{} + (footer()) + ) +} diff --git a/src/templates/views/settings.rs b/src/templates/views/settings.rs new file mode 100644 index 0000000..7d89c17 --- /dev/null +++ b/src/templates/views/settings.rs @@ -0,0 +1,45 @@ +//! + +use maud::{html, Markup}; + +use crate::templates::partials::{ + footer::footer, + header::header, + settings_tabs::{ + cookies::cookies, engines::engines, general::general, user_interface::user_interface, + }, +}; + +/// +pub fn settings( + colorscheme: &str, + theme: &str, + engine_names: &[&String], +) -> Result> { + Ok(html!( + (header(colorscheme, theme)) + main class="settings"{ + h1{"Settings"} + hr; + .settings_container{ + .sidebar{ + div class="btn active" onclick="setActiveTab(this)"{"general"} + .btn onclick="setActiveTab(this)"{"user interface"} + .btn onclick="setActiveTab(this)"{"engines"} + .btn onclick="setActiveTab(this)"{"cookies"} + } + .main_container{ + (general()) + (user_interface()?) + (engines(engine_names)) + (cookies()) + p class="message"{} + button type="submit" onclick="setClientSettings()"{"Save"} + } + } + } + script src="static/settings.js"{} + script src="static/cookies.js"{} + (footer()) + )) +} From 64c4d2c23a3eb8355191f2efdab71bb0aeabb882 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Fri, 17 Nov 2023 22:12:25 +0300 Subject: [PATCH 18/39] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20refactor(routes):?= =?UTF-8?q?=20serve=20new=20the=20maud=20files=20instead=20of=20handlebars?= =?UTF-8?q?=20files=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/router.rs | 47 +++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/server/router.rs b/src/server/router.rs index 69a3ede..48f0d77 100644 --- a/src/server/router.rs +++ b/src/server/router.rs @@ -7,30 +7,30 @@ use crate::{ handler::paths::{file_path, FileType}, }; use actix_web::{get, web, HttpRequest, HttpResponse}; -use handlebars::Handlebars; use std::fs::read_to_string; /// Handles the route of index page or main page of the `websurfx` meta search engine website. #[get("/")] -pub async fn index( - hbs: web::Data>, - config: web::Data, -) -> Result> { - let page_content: String = hbs.render("index", &config.style).unwrap(); - Ok(HttpResponse::Ok().body(page_content)) +pub async fn index(config: web::Data) -> Result> { + Ok(HttpResponse::Ok().body( + crate::templates::views::index::index(&config.style.colorscheme, &config.style.theme, "").0, + )) } /// Handles the route of any other accessed route/page which is not provided by the /// website essentially the 404 error page. pub async fn not_found( - hbs: web::Data>, config: web::Data, ) -> Result> { - let page_content: String = hbs.render("404", &config.style)?; - Ok(HttpResponse::Ok() .content_type("text/html; charset=utf-8") - .body(page_content)) + .body( + crate::templates::views::not_found::not_found( + &config.style.colorscheme, + &config.style.theme, + ) + .0, + )) } /// Handles the route of robots.txt page of the `websurfx` meta search engine website. @@ -45,20 +45,27 @@ pub async fn robots_data(_req: HttpRequest) -> Result>, - config: web::Data, -) -> Result> { - let page_content: String = hbs.render("about", &config.style)?; - Ok(HttpResponse::Ok().body(page_content)) +pub async fn about(config: web::Data) -> Result> { + Ok(HttpResponse::Ok().body( + crate::templates::views::about::about(&config.style.colorscheme, &config.style.theme).0, + )) } /// Handles the route of settings page of the `websurfx` meta search engine website. #[get("/settings")] pub async fn settings( - hbs: web::Data>, config: web::Data, ) -> Result> { - let page_content: String = hbs.render("settings", &config.style)?; - Ok(HttpResponse::Ok().body(page_content)) + Ok(HttpResponse::Ok().body( + crate::templates::views::settings::settings( + &config.style.colorscheme, + &config.style.theme, + &config + .upstream_search_engines + .iter() + .map(|(engine, _)| engine) + .collect::>(), + )? + .0, + )) } From 38ba4bd6cb3120a56f2f99cf154159097bdce27a Mon Sep 17 00:00:00 2001 From: neon_arch Date: Fri, 17 Nov 2023 22:16:17 +0300 Subject: [PATCH 19/39] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(routes):=20?= =?UTF-8?q?serve=20the=20new=20maud=20file=20for=20search=20page=20and=20r?= =?UTF-8?q?emove=20unwanted=20functions=20and=20pass=20values=20to=20the?= =?UTF-8?q?=20maud=20html=20template=20directly=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/routes/search.rs | 67 +++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/src/server/routes/search.rs b/src/server/routes/search.rs index 9dbd1e1..ab5bc93 100644 --- a/src/server/routes/search.rs +++ b/src/server/routes/search.rs @@ -6,13 +6,12 @@ use crate::{ handler::paths::{file_path, FileType}, models::{ aggregation_models::SearchResults, - engine_models::EngineHandler, + engine_models::{EngineError, EngineHandler}, server_models::{Cookie, SearchParams}, }, results::aggregator::aggregate, }; use actix_web::{get, web, HttpRequest, HttpResponse}; -use handlebars::Handlebars; use regex::Regex; use std::{ fs::File, @@ -20,19 +19,6 @@ use std::{ }; use tokio::join; -/// Handles the route of any other accessed route/page which is not provided by the -/// website essentially the 404 error page. -pub async fn not_found( - hbs: web::Data>, - config: web::Data, -) -> Result> { - let page_content: String = hbs.render("404", &config.style)?; - - Ok(HttpResponse::Ok() - .content_type("text/html; charset=utf-8") - .body(page_content)) -} - /// Handles the route of search page of the `websurfx` meta search engine website and it takes /// two search url parameters `q` and `page` where `page` parameter is optional. /// @@ -49,7 +35,6 @@ pub async fn not_found( /// ``` #[get("/search")] pub async fn search( - hbs: web::Data>, req: HttpRequest, config: web::Data, cache: web::Data, @@ -58,7 +43,7 @@ pub async fn search( match ¶ms.q { Some(query) => { if query.trim().is_empty() { - return Ok(HttpResponse::Found() + return Ok(HttpResponse::TemporaryRedirect() .insert_header(("location", "/")) .finish()); } @@ -112,10 +97,17 @@ pub async fn search( ) ); - let page_content: String = hbs.render("search", &results?)?; - Ok(HttpResponse::Ok().body(page_content)) + Ok(HttpResponse::Ok().body( + crate::templates::views::search::search( + &config.style.colorscheme, + &config.style.theme, + query, + &results?, + ) + .0, + )) } - None => Ok(HttpResponse::Found() + None => Ok(HttpResponse::TemporaryRedirect() .insert_header(("location", "/")) .finish()), } @@ -150,7 +142,7 @@ async fn results( // check if fetched cache results was indeed fetched or it was an error and if so // handle the data accordingly. match cached_results { - Ok(results) => Ok(results), + Ok(results) => Ok(dbg!(results.clone())), Err(_) => { let mut safe_search_level: u8 = match config.safe_search { 3..=4 => config.safe_search, @@ -171,8 +163,6 @@ async fn results( if _flag { results.set_disallowed(); - results.add_style(&config.style); - results.set_page_query(query); cache.cache_results(&results, &url).await?; results.set_safe_search_level(safe_search_level); return Ok(results); @@ -221,23 +211,27 @@ async fn results( true => { let mut search_results = SearchResults::default(); search_results.set_no_engines_selected(); - search_results.set_page_query(query); search_results } } } - None => { - aggregate( - query, - page, - config.aggregator.random_delay, - config.debug, - &config.upstream_search_engines, - config.request_timeout, - safe_search_level, - ) - .await? - } + None => aggregate( + query, + page, + config.aggregator.random_delay, + config.debug, + &config + .upstream_search_engines + .clone() + .into_iter() + .filter_map(|(key, value)| value.then_some(key)) + .map(|engine| EngineHandler::new(&engine)) + .collect::, error_stack::Report>>( + )?, + config.request_timeout, + safe_search_level, + ) + .await?, }; if results.engine_errors_info().is_empty() && results.results().is_empty() @@ -245,7 +239,6 @@ async fn results( { results.set_filtered(); } - results.add_style(&config.style); cache .cache_results(&results, &(format!("{url}{safe_search_level}"))) .await?; From c1a5b7086aed44558c524d613491bae62a7710f6 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:23:22 +0300 Subject: [PATCH 20/39] =?UTF-8?q?=F0=9F=92=A1=20chore:=20add=20documentati?= =?UTF-8?q?on=20to=20the=20code=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/templates/mod.rs | 3 ++- src/templates/partials/bar.rs | 13 ++++++++++-- src/templates/partials/footer.rs | 7 ++++++- src/templates/partials/header.rs | 11 +++++++++- src/templates/partials/mod.rs | 6 +++--- src/templates/partials/navbar.rs | 6 +++++- src/templates/partials/search_bar.rs | 14 ++++++++++++- .../partials/settings_tabs/cookies.rs | 6 +++++- .../partials/settings_tabs/engines.rs | 10 ++++++++- .../partials/settings_tabs/general.rs | 9 ++++++-- src/templates/partials/settings_tabs/mod.rs | 7 ++++--- .../partials/settings_tabs/user_interface.rs | 21 +++++++++++++++++-- src/templates/views/about.rs | 11 +++++++++- src/templates/views/index.rs | 15 ++++++++++--- src/templates/views/mod.rs | 5 +++-- src/templates/views/not_found.rs | 13 ++++++++++-- src/templates/views/search.rs | 13 +++++++++++- src/templates/views/settings.rs | 13 +++++++++++- 18 files changed, 154 insertions(+), 29 deletions(-) diff --git a/src/templates/mod.rs b/src/templates/mod.rs index cddec20..bc39dce 100644 --- a/src/templates/mod.rs +++ b/src/templates/mod.rs @@ -1,4 +1,5 @@ -//! +//! This module provides other modules to handle both the view and its partials for the `websurfx` +//! search engine frontend. mod partials; pub mod views; diff --git a/src/templates/partials/bar.rs b/src/templates/partials/bar.rs index da6939d..13f78a8 100644 --- a/src/templates/partials/bar.rs +++ b/src/templates/partials/bar.rs @@ -1,8 +1,17 @@ -//! +//! A module that handles `bar` partial for the `search_bar` partial and the home/index/main page in the `websurfx` frontend. -use maud::{html, Markup,PreEscaped}; +use maud::{html, Markup, PreEscaped}; +/// A functions that handles the html code for the bar for the `search_bar` partial and the +/// home/index/main page in the search engine frontend. /// +/// # Arguments +/// +/// * `query` - It takes the current search query provided by user as an argument. +/// +/// # Returns +/// +/// It returns the compiled html code for the search bar as a result. pub fn bar(query: &str) -> Markup { html!( (PreEscaped("
")) diff --git a/src/templates/partials/footer.rs b/src/templates/partials/footer.rs index c35aa4f..beaa8ca 100644 --- a/src/templates/partials/footer.rs +++ b/src/templates/partials/footer.rs @@ -1,8 +1,13 @@ -//! +//! A module that handles the footer for all the pages in the `websurfx` frontend. use maud::{html, Markup, PreEscaped}; +/// A functions that handles the html code for the footer for all the pages in the search engine +/// frontend. /// +/// # Returns +/// +/// It returns the compiled html code for the footer as a result. pub fn footer() -> Markup { html!( footer{ diff --git a/src/templates/partials/header.rs b/src/templates/partials/header.rs index 6b0c60f..c477aec 100644 --- a/src/templates/partials/header.rs +++ b/src/templates/partials/header.rs @@ -1,9 +1,18 @@ -//! +//! A module that handles the header for all the pages in the `websurfx` frontend. use crate::templates::partials::navbar::navbar; use maud::{html, Markup, PreEscaped, DOCTYPE}; +/// A function that handles the html code for the header for all the pages in the search engine frontend. /// +/// # Arguments +/// +/// * `colorscheme` - It takes the colorscheme name as an argument. +/// * `theme` - It takes the theme name as an argument. +/// +/// # Returns +/// +/// It returns the compiled html markup code for the header as a result. pub fn header(colorscheme: &str, theme: &str) -> Markup { html!( (DOCTYPE) diff --git a/src/templates/partials/mod.rs b/src/templates/partials/mod.rs index 3635d80..0e6b803 100644 --- a/src/templates/partials/mod.rs +++ b/src/templates/partials/mod.rs @@ -1,8 +1,8 @@ -//! +//! This module provides other modules to handle the partials for the views in the `websurfx` frontend. +pub mod bar; pub mod footer; pub mod header; pub mod navbar; -pub mod bar; -pub mod settings_tabs; pub mod search_bar; +pub mod settings_tabs; diff --git a/src/templates/partials/navbar.rs b/src/templates/partials/navbar.rs index 812ca5c..f1f86fd 100644 --- a/src/templates/partials/navbar.rs +++ b/src/templates/partials/navbar.rs @@ -1,8 +1,12 @@ -//! +//! A module that handles `navbar` partial for the header partial in the `websurfx` frontend. use maud::{html, Markup}; +/// A functions that handles the html code for the header partial. /// +/// # Returns +/// +/// It returns the compiled html code for the navbar as a result. pub fn navbar() -> Markup { html!( nav{ diff --git a/src/templates/partials/search_bar.rs b/src/templates/partials/search_bar.rs index b1eb48f..c40244c 100644 --- a/src/templates/partials/search_bar.rs +++ b/src/templates/partials/search_bar.rs @@ -1,12 +1,24 @@ -//! +//! A module that handles `search bar` partial for the search page in the `websurfx` frontend. use maud::{html, Markup, PreEscaped}; use crate::{models::aggregation_models::EngineErrorInfo, templates::partials::bar::bar}; +/// A constant holding the named safe search level options for the corresponding values 0, 1 and 2. const SAFE_SEARCH_LEVELS_NAME: [&str; 3] = ["None", "Low", "Moderate"]; +/// A functions that handles the html code for the search bar for the search page. /// +/// # Arguments +/// +/// * `engine_errors_info` - It takes the engine errors list containing errors for each upstream +/// search engine which failed to provide results as an argument. +/// * `safe_search_level` - It takes the safe search level with values from 0-2 as an argument. +/// * `query` - It takes the current search query provided by user as an argument. +/// +/// # Returns +/// +/// It returns the compiled html code for the search bar as a result. pub fn search_bar( engine_errors_info: &[EngineErrorInfo], safe_search_level: u8, diff --git a/src/templates/partials/settings_tabs/cookies.rs b/src/templates/partials/settings_tabs/cookies.rs index 5b673b1..c8bc8e6 100644 --- a/src/templates/partials/settings_tabs/cookies.rs +++ b/src/templates/partials/settings_tabs/cookies.rs @@ -1,8 +1,12 @@ -//! +//! A module that handles the engines tab for setting page view in the `websurfx` frontend. use maud::{html, Markup}; +/// A functions that handles the html code for the cookies tab for the settings page for the search page. /// +/// # Returns +/// +/// It returns the compiled html markup code for the cookies tab. pub fn cookies() -> Markup { html!( div class="cookies tab"{ diff --git a/src/templates/partials/settings_tabs/engines.rs b/src/templates/partials/settings_tabs/engines.rs index 1272926..5394178 100644 --- a/src/templates/partials/settings_tabs/engines.rs +++ b/src/templates/partials/settings_tabs/engines.rs @@ -1,8 +1,16 @@ -//! +//! A module that handles the engines tab for setting page view in the `websurfx` frontend. use maud::{html, Markup}; +/// A functions that handles the html code for the engines tab for the settings page for the search page. /// +/// # Arguments +/// +/// * `engine_names` - It takes the list of all available engine names as an argument. +/// +/// # Returns +/// +/// It returns the compiled html markup code for the engines tab. pub fn engines(engine_names: &[&String]) -> Markup { html!( div class="engines tab"{ diff --git a/src/templates/partials/settings_tabs/general.rs b/src/templates/partials/settings_tabs/general.rs index 06c4258..4b0043d 100644 --- a/src/templates/partials/settings_tabs/general.rs +++ b/src/templates/partials/settings_tabs/general.rs @@ -1,10 +1,15 @@ -//! +//! A module that handles the general tab for setting page view in the `websurfx` frontend. use maud::{html, Markup}; -const SAFE_SEARCH_LEVELS: [(u8, &'static str); 3] = [(0, "None"), (1, "Low"), (2, "Moderate")]; +/// A constant holding the named safe search level options for the corresponding values 0, 1 and 2. +const SAFE_SEARCH_LEVELS: [(u8, &str); 3] = [(0, "None"), (1, "Low"), (2, "Moderate")]; +/// A functions that handles the html code for the general tab for the settings page for the search page. /// +/// # Returns +/// +/// It returns the compiled html markup code for the general tab. pub fn general() -> Markup { html!( div class="general tab active"{ diff --git a/src/templates/partials/settings_tabs/mod.rs b/src/templates/partials/settings_tabs/mod.rs index ab73511..84973d9 100644 --- a/src/templates/partials/settings_tabs/mod.rs +++ b/src/templates/partials/settings_tabs/mod.rs @@ -1,6 +1,7 @@ -//! +//! This module provides other modules to handle the partials for the tabs for the settings page +//! view in the `websurfx` frontend. -pub mod general; -pub mod engines; pub mod cookies; +pub mod engines; +pub mod general; pub mod user_interface; diff --git a/src/templates/partials/settings_tabs/user_interface.rs b/src/templates/partials/settings_tabs/user_interface.rs index 76580b9..90e1ce9 100644 --- a/src/templates/partials/settings_tabs/user_interface.rs +++ b/src/templates/partials/settings_tabs/user_interface.rs @@ -1,9 +1,21 @@ -//! +//! A module that handles the user interface tab for setting page view in the `websurfx` frontend. use crate::handler::paths::{file_path, FileType}; use maud::{html, Markup}; use std::fs::read_dir; +/// A helper function that helps in building the list of all available colorscheme/theme names +/// present in the colorschemes and themes folder respectively. +/// +/// # Arguments +/// +/// * `style_type` - It takes the style type of the values `theme` and `colorscheme` as an +/// argument. +/// +/// # Error +/// +/// Returns a list of colorscheme/theme names as a vector of tuple strings on success otherwise +/// returns a standard error message. fn style_option_list( style_type: &str, ) -> Result, Box> { @@ -14,13 +26,18 @@ fn style_option_list( style_type, ))? { let style_name = file?.file_name().to_str().unwrap().replace(".css", ""); - style_option_names.push((style_name.clone(), style_name.replace("-", " "))); + style_option_names.push((style_name.clone(), style_name.replace('-', " "))); } Ok(style_option_names) } +/// A functions that handles the html code for the user interface tab for the settings page for the search page. /// +/// # Error +/// +/// It returns the compiled html markup code for the user interface tab on success otherwise +/// returns a standard error message. pub fn user_interface() -> Result> { Ok(html!( div class="user_interface tab"{ diff --git a/src/templates/views/about.rs b/src/templates/views/about.rs index 419187d..9ee2d6d 100644 --- a/src/templates/views/about.rs +++ b/src/templates/views/about.rs @@ -1,10 +1,19 @@ -//! +//! A module that handles the view for the about page in the `websurfx` frontend. use maud::{html, Markup}; use crate::templates::partials::{footer::footer, header::header}; +/// A function that handles the html code for the about page view in the search engine frontend. /// +/// # Arguments +/// +/// * `colorscheme` - It takes the colorscheme name as an argument. +/// * `theme` - It takes the theme name as an argument. +/// +/// # Returns +/// +/// It returns the compiled html markup code as a result. pub fn about(colorscheme: &str, theme: &str) -> Markup { html!( (header(colorscheme, theme)) diff --git a/src/templates/views/index.rs b/src/templates/views/index.rs index ae5acf8..3816f22 100644 --- a/src/templates/views/index.rs +++ b/src/templates/views/index.rs @@ -1,16 +1,25 @@ -//! +//! A module that handles the view for the index/home/main page in the `websurfx` frontend. use maud::{html, Markup, PreEscaped}; use crate::templates::partials::{bar::bar, footer::footer, header::header}; +/// A function that handles the html code for the index/html/main page view in the search engine frontend. /// -pub fn index(colorscheme: &str, theme: &str, query: &str) -> Markup { +/// # Arguments +/// +/// * `colorscheme` - It takes the colorscheme name as an argument. +/// * `theme` - It takes the theme name as an argument. +/// +/// # Returns +/// +/// It returns the compiled html markup code as a result. +pub fn index(colorscheme: &str, theme: &str) -> Markup { html!( (header(colorscheme, theme)) main class="search-container"{ img src="../images/websurfx_logo.png" alt="Websurfx meta-search engine logo"; - (bar(query)) + (bar(&String::default())) (PreEscaped("
")) } script src="static/index.js"{} diff --git a/src/templates/views/mod.rs b/src/templates/views/mod.rs index 5093897..bbfe189 100644 --- a/src/templates/views/mod.rs +++ b/src/templates/views/mod.rs @@ -1,7 +1,8 @@ -//! +//! This module provides other modules to handle view for each individual page in the +//! `websurfx` frontend. pub mod about; pub mod index; pub mod not_found; -pub mod settings; pub mod search; +pub mod settings; diff --git a/src/templates/views/not_found.rs b/src/templates/views/not_found.rs index 4f809b1..9e23da9 100644 --- a/src/templates/views/not_found.rs +++ b/src/templates/views/not_found.rs @@ -1,15 +1,24 @@ -//! +//! A module that handles the view for the 404 page in the `websurfx` frontend. use crate::templates::partials::{footer::footer, header::header}; use maud::{html, Markup}; +/// A function that handles the html code for the 404 page view in the search engine frontend. /// +/// # Arguments +/// +/// * `colorscheme` - It takes the colorscheme name as an argument. +/// * `theme` - It takes the theme name as an argument. +/// +/// # Returns +/// +/// It returns the compiled html markup code as a result. pub fn not_found(colorscheme: &str, theme: &str) -> Markup { html!( (header(colorscheme, theme)) main class="error_container"{ img src="images/robot-404.svg" alt="Image of broken robot."; - div class="error_content"{ + .error_content{ h1{"Aw! snap"} h2{"404 Page Not Found!"} p{"Go to "{a href="/"{"search page"}}} diff --git a/src/templates/views/search.rs b/src/templates/views/search.rs index 90e8b0e..440d585 100644 --- a/src/templates/views/search.rs +++ b/src/templates/views/search.rs @@ -1,4 +1,4 @@ -//! +//! A module that handles the view for the search page in the `websurfx` frontend. use maud::{html, Markup, PreEscaped}; @@ -7,7 +7,18 @@ use crate::{ templates::partials::{footer::footer, header::header, search_bar::search_bar}, }; +/// A function that handles the html code for the search page view in the search engine frontend. /// +/// # Arguments +/// +/// * `colorscheme` - It takes the colorscheme name as an argument. +/// * `theme` - It takes the theme name as an argument. +/// * `query` - It takes the current search query provided by the user as an argument. +/// * `search_results` - It takes the aggregated search results as an argument. +/// +/// # Returns +/// +/// It returns the compiled html markup code as a result. pub fn search( colorscheme: &str, theme: &str, diff --git a/src/templates/views/settings.rs b/src/templates/views/settings.rs index 7d89c17..7b69ac7 100644 --- a/src/templates/views/settings.rs +++ b/src/templates/views/settings.rs @@ -1,4 +1,4 @@ -//! +//! A module that handles the view for the settings page in the `websurfx` frontend. use maud::{html, Markup}; @@ -10,7 +10,18 @@ use crate::templates::partials::{ }, }; +/// A function that handles the html code for the settings page view in the search engine frontend. /// +/// # Arguments +/// +/// * `colorscheme` - It takes the colorscheme name as an argument. +/// * `theme` - It takes the theme name as an argument. +/// * `engine_names` - It takes a list of engine names as an argument. +/// +/// # Error +/// +/// This function returns a compiled html markup code on success otherwise returns a standard error +/// message. pub fn settings( colorscheme: &str, theme: &str, From ca1c72c3dc6b850127df01159bf9bcd23d4ed9c9 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:27:49 +0300 Subject: [PATCH 21/39] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20remove?= =?UTF-8?q?=20handlebar=20related=20code=20&=20add=20the=20templates=20mod?= =?UTF-8?q?ule=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 73e9364..1d245fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,7 @@ pub mod handler; pub mod models; pub mod results; pub mod server; +pub mod templates; use std::net::TcpListener; @@ -23,7 +24,6 @@ use actix_governor::{Governor, GovernorConfigBuilder}; use actix_web::{dev::Server, http::header, middleware::Logger, web, App, HttpServer}; use cache::cacher::{Cache, SharedCache}; use config::parser::Config; -use handlebars::Handlebars; use handler::paths::{file_path, FileType}; /// Runs the web server on the provided TCP listener and returns a `Server` instance. @@ -48,16 +48,8 @@ use handler::paths::{file_path, FileType}; /// let server = run(listener,config,cache).expect("Failed to start server"); /// ``` pub fn run(listener: TcpListener, config: Config, cache: Cache) -> std::io::Result { - let mut handlebars: Handlebars<'_> = Handlebars::new(); - let public_folder_path: &str = file_path(FileType::Theme)?; - handlebars - .register_templates_directory(".html", format!("{}/templates", public_folder_path)) - .unwrap(); - - let handlebars_ref: web::Data> = web::Data::new(handlebars); - let cloned_config_threads_opt: u8 = config.threads; let cache = web::Data::new(SharedCache::new(cache)); @@ -75,7 +67,6 @@ pub fn run(listener: TcpListener, config: Config, cache: Cache) -> std::io::Resu App::new() .wrap(Logger::default()) // added logging middleware for logging. - .app_data(handlebars_ref.clone()) .app_data(web::Data::new(config.clone())) .app_data(cache.clone()) .wrap(cors) From 47905f1e22031196213fe220fcad3de9d3ad48d9 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:29:35 +0300 Subject: [PATCH 22/39] =?UTF-8?q?=E2=9C=85=20test:=20update=20the=20integr?= =?UTF-8?q?ation=20with=20the=20new=20changes=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/index.rs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/tests/index.rs b/tests/index.rs index 91d0814..3bd7381 100644 --- a/tests/index.rs +++ b/tests/index.rs @@ -1,7 +1,6 @@ use std::net::TcpListener; -use handlebars::Handlebars; -use websurfx::{config::parser::Config, run}; +use websurfx::{config::parser::Config, run, templates::views}; // Starts a new instance of the HTTP server, bound to a random available port fn spawn_app() -> String { @@ -21,18 +20,6 @@ fn spawn_app() -> String { format!("http://127.0.0.1:{}/", port) } -// Creates a new instance of Handlebars and registers the templates directory. -// This is used to compare the rendered template with the response body. -fn handlebars() -> Handlebars<'static> { - let mut handlebars = Handlebars::new(); - - handlebars - .register_templates_directory(".html", "./public/templates") - .unwrap(); - - handlebars -} - #[tokio::test] async fn test_index() { let address = spawn_app(); @@ -41,9 +28,8 @@ async fn test_index() { let res = client.get(address).send().await.unwrap(); assert_eq!(res.status(), 200); - let handlebars = handlebars(); let config = Config::parse(true).unwrap(); - let template = handlebars.render("index", &config.style).unwrap(); + let template = views::index::index(&config.style.colorscheme, &config.style.theme).0; assert_eq!(res.text().await.unwrap(), template); } From 141ae260662630b024b5de4c665ea6bca1fec454 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:38:02 +0300 Subject: [PATCH 23/39] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20remove?= =?UTF-8?q?=20the=20code=20to=20add=20the=20`query`=20&=20`style`=20in=20t?= =?UTF-8?q?he=20`SearchResults`=20struct=20&=20also=20remove=20the=20assoc?= =?UTF-8?q?iated=20fields=20from=20the=20struct=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/aggregation_models.rs | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/src/models/aggregation_models.rs b/src/models/aggregation_models.rs index 660804e..680d222 100644 --- a/src/models/aggregation_models.rs +++ b/src/models/aggregation_models.rs @@ -1,11 +1,10 @@ //! This module provides public models for handling, storing and serializing of search results //! data scraped from the upstream search engines. +use super::engine_models::EngineError; use serde::{Deserialize, Serialize}; use smallvec::SmallVec; -use super::{engine_models::EngineError, parser_models::Style}; - /// A named struct to store the raw scraped search results scraped search results from the /// upstream search engines before aggregating it.It derives the Clone trait which is needed /// to write idiomatic rust using `Iterators`. @@ -109,10 +108,6 @@ impl EngineErrorInfo { pub struct SearchResults { /// Stores the individual serializable `SearchResult` struct into a vector of pub results: Vec, - /// Stores the current pages search query `q` provided in the search url. - pub page_query: String, - /// Stores the theming options for the website. - pub style: Style, /// Stores the information on which engines failed with their engine name /// and the type of error that caused it. pub engine_errors_info: Vec, @@ -142,15 +137,9 @@ impl SearchResults { /// the search url. /// * `engine_errors_info` - Takes an array of structs which contains information regarding /// which engines failed with their names, reason and their severity color name. - pub fn new( - results: Vec, - page_query: &str, - engine_errors_info: &[EngineErrorInfo], - ) -> Self { + pub fn new(results: Vec, engine_errors_info: &[EngineErrorInfo]) -> Self { Self { results, - page_query: page_query.to_owned(), - style: Style::default(), engine_errors_info: engine_errors_info.to_owned(), disallowed: Default::default(), filtered: Default::default(), @@ -159,21 +148,11 @@ impl SearchResults { } } - /// A setter function to add website style to the return search results. - pub fn add_style(&mut self, style: &Style) { - self.style = style.clone(); - } - /// A setter function that sets disallowed to true. pub fn set_disallowed(&mut self) { self.disallowed = true; } - /// A setter function to set the current page search query. - pub fn set_page_query(&mut self, page: &str) { - self.page_query = page.to_owned(); - } - /// A setter function that sets the filtered to true. pub fn set_filtered(&mut self) { self.filtered = true; From 5c60d733cd95b2a32606f8385eb76bbf92e375bb Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:41:08 +0300 Subject: [PATCH 24/39] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20remove?= =?UTF-8?q?=20the=20code=20to=20pass=20the=20`query`=20data=20into=20the?= =?UTF-8?q?=20`SearchResults`=20struct=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/results/aggregator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/results/aggregator.rs b/src/results/aggregator.rs index b57768f..f605260 100644 --- a/src/results/aggregator.rs +++ b/src/results/aggregator.rs @@ -166,7 +166,7 @@ pub async fn aggregate( let results: Vec = result_map.into_values().collect(); - Ok(SearchResults::new(results, query, &engine_errors_info)) + Ok(SearchResults::new(results, &engine_errors_info)) } /// Filters a map of search results using a list of regex patterns. From 686e26ad6d61ba92a217b069cf2f1c977055d1ae Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:43:28 +0300 Subject: [PATCH 25/39] =?UTF-8?q?=E2=9A=B0=EF=B8=8F=20=20chore:=20remove?= =?UTF-8?q?=20the=20serialize=20&=20deserialize=20traits=20on=20the=20stru?= =?UTF-8?q?ct=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/parser_models.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/models/parser_models.rs b/src/models/parser_models.rs index 9dad348..a669bd6 100644 --- a/src/models/parser_models.rs +++ b/src/models/parser_models.rs @@ -1,8 +1,6 @@ //! This module provides public models for handling, storing and serializing parsed config file //! options from config.lua by grouping them together. -use serde::{Deserialize, Serialize}; - /// A named struct which stores,deserializes, serializes and groups the parsed config file options /// of theme and colorscheme names into the Style struct which derives the `Clone`, `Serialize` /// and Deserialize traits where the `Clone` trait is derived for allowing the struct to be @@ -12,7 +10,7 @@ use serde::{Deserialize, Serialize}; /// order to allow the deserializing the json back to struct in aggregate function in /// aggregator.rs and create a new struct out of it and then serialize it back to json and pass /// it to the template files. -#[derive(Serialize, Deserialize, Clone, Default)] +#[derive(Clone, Default)] pub struct Style { /// It stores the parsed theme option used to set a theme for the website. pub theme: String, From c39d9ff0b08621ff40a68389a3fafe98ae91e431 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:46:36 +0300 Subject: [PATCH 26/39] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20rewrite?= =?UTF-8?q?=20the=20parsing=20of=20the=20upstream=20search=20engines=20opt?= =?UTF-8?q?ion=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/parser.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/config/parser.rs b/src/config/parser.rs index 0acdd25..1b8ba16 100644 --- a/src/config/parser.rs +++ b/src/config/parser.rs @@ -3,7 +3,6 @@ use crate::handler::paths::{file_path, FileType}; -use crate::models::engine_models::{EngineError, EngineHandler}; use crate::models::parser_models::{AggregatorConfig, RateLimiter, Style}; use log::LevelFilter; use mlua::Lua; @@ -29,7 +28,7 @@ pub struct Config { /// It stores the option to whether enable or disable debug mode. pub debug: bool, /// It stores all the engine names that were enabled by the user. - pub upstream_search_engines: Vec, + pub upstream_search_engines: HashMap, /// It stores the time (secs) which controls the server request timeout. pub request_timeout: u8, /// It stores the number of threads which controls the app will use to run. @@ -109,11 +108,7 @@ impl Config { logging, debug, upstream_search_engines: globals - .get::<_, HashMap>("upstream_search_engines")? - .into_iter() - .filter_map(|(key, value)| value.then_some(key)) - .map(|engine| EngineHandler::new(&engine)) - .collect::, error_stack::Report>>()?, + .get::<_, HashMap>("upstream_search_engines")?, request_timeout: globals.get::<_, u8>("request_timeout")?, threads, rate_limiter: RateLimiter { From eee2f110b86602d008f5d73b08604b071c742616 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:50:37 +0300 Subject: [PATCH 27/39] =?UTF-8?q?=F0=9F=9A=A8=20chore:=20make=20cargo=20cl?= =?UTF-8?q?ippy=20linter=20happy=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/router.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/server/router.rs b/src/server/router.rs index 48f0d77..31b7e6a 100644 --- a/src/server/router.rs +++ b/src/server/router.rs @@ -13,7 +13,7 @@ use std::fs::read_to_string; #[get("/")] pub async fn index(config: web::Data) -> Result> { Ok(HttpResponse::Ok().body( - crate::templates::views::index::index(&config.style.colorscheme, &config.style.theme, "").0, + crate::templates::views::index::index(&config.style.colorscheme, &config.style.theme).0, )) } @@ -62,8 +62,7 @@ pub async fn settings( &config.style.theme, &config .upstream_search_engines - .iter() - .map(|(engine, _)| engine) + .keys() .collect::>(), )? .0, From 03d649b97bbdd660425bfe9a09616943e5cbfea2 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:51:21 +0300 Subject: [PATCH 28/39] =?UTF-8?q?=F0=9F=94=A5=20chore:=20remove=20the=20de?= =?UTF-8?q?bug=20macro=20from=20the=20code=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/routes/search.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/routes/search.rs b/src/server/routes/search.rs index ab5bc93..35c9cc4 100644 --- a/src/server/routes/search.rs +++ b/src/server/routes/search.rs @@ -142,7 +142,7 @@ async fn results( // check if fetched cache results was indeed fetched or it was an error and if so // handle the data accordingly. match cached_results { - Ok(results) => Ok(dbg!(results.clone())), + Ok(results) => Ok(results), Err(_) => { let mut safe_search_level: u8 = match config.safe_search { 3..=4 => config.safe_search, From 9b1d89404e36cc6811017dbf4ac3e5de32291fc0 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:56:00 +0300 Subject: [PATCH 29/39] =?UTF-8?q?=F0=9F=94=96=20chore:=20bump=20the=20app?= =?UTF-8?q?=20version=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 303 ++++++++++++++++++++++++----------------------------- Cargo.toml | 2 +- 2 files changed, 136 insertions(+), 169 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c308b5..f6b5ae5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,7 +14,7 @@ dependencies = [ "futures-sink", "memchr", "pin-project-lite", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-util", "tracing", ] @@ -31,7 +31,7 @@ dependencies = [ "futures-util", "log", "once_cell", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -87,7 +87,7 @@ dependencies = [ "derive_more", "encoding_rs", "futures-core", - "http 0.2.9", + "http 0.2.11", "httparse", "httpdate", "itoa 1.0.9", @@ -98,8 +98,8 @@ dependencies = [ "pin-project-lite", "rand 0.8.5", "sha1", - "smallvec 1.11.1", - "tokio 1.33.0", + "smallvec 1.11.2", + "tokio 1.34.0", "tokio-util", "tracing", ] @@ -121,7 +121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" dependencies = [ "bytestring", - "http 0.2.9", + "http 0.2.11", "regex", "serde", "tracing", @@ -134,7 +134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" dependencies = [ "futures-core", - "tokio 1.33.0", + "tokio 1.34.0", ] [[package]] @@ -150,7 +150,7 @@ dependencies = [ "futures-util", "mio 0.8.9", "socket2 0.5.5", - "tokio 1.33.0", + "tokio 1.34.0", "tracing", ] @@ -209,7 +209,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded 0.7.1", - "smallvec 1.11.1", + "smallvec 1.11.2", "socket2 0.5.5", "time 0.3.30", "url 2.4.1", @@ -414,9 +414,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" dependencies = [ "memchr", "serde", @@ -562,18 +562,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" dependencies = [ "anstyle", "clap_lex", @@ -604,7 +604,7 @@ dependencies = [ "futures-core", "memchr", "pin-project-lite", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-util", ] @@ -828,7 +828,7 @@ dependencies = [ "dtoa-short", "itoa 1.0.9", "phf 0.11.2", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -841,7 +841,7 @@ dependencies = [ "dtoa-short", "itoa 1.0.9", "phf 0.11.2", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -974,9 +974,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ "log", ] @@ -988,14 +988,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059" dependencies = [ "fsio", - "indexmap", + "indexmap 1.9.3", ] [[package]] -name = "errno" -version = "0.3.6" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", "windows-sys", @@ -1314,7 +1320,7 @@ dependencies = [ "parking_lot 0.12.1", "quanta", "rand 0.8.5", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -1328,7 +1334,7 @@ dependencies = [ "fnv", "futures 0.1.31", "http 0.1.21", - "indexmap", + "indexmap 1.9.3", "log", "slab", "string", @@ -1337,19 +1343,19 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes 1.5.0", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.9", - "indexmap", + "http 0.2.11", + "indexmap 2.1.0", "slab", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-util", "tracing", ] @@ -1360,21 +1366,6 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" -[[package]] -name = "handlebars" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" -dependencies = [ - "log", - "pest", - "pest_derive", - "serde", - "serde_json", - "thiserror", - "walkdir", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -1453,9 +1444,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes 1.5.0", "fnv", @@ -1481,7 +1472,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes 1.5.0", - "http 0.2.9", + "http 0.2.11", "pin-project-lite", ] @@ -1543,15 +1534,15 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.21", - "http 0.2.9", + "h2 0.3.22", + "http 0.2.11", "http-body 0.4.5", "httparse", "httpdate", "itoa 1.0.9", "pin-project-lite", "socket2 0.4.10", - "tokio 1.33.0", + "tokio 1.34.0", "tower-service", "tracing", "want 0.3.1", @@ -1564,10 +1555,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.9", + "http 0.2.11", "hyper 0.14.27", "rustls", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-rustls", ] @@ -1626,6 +1617,16 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.2", +] + [[package]] name = "iovec" version = "0.1.4" @@ -1737,7 +1738,7 @@ dependencies = [ "parcel_selectors", "paste", "pathdiff", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -1859,6 +1860,30 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" +[[package]] +name = "maud" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0bab19cef8a7fe1c18a43e881793bfc9d4ea984befec3ae5bd0415abf3ecf00" +dependencies = [ + "actix-web", + "futures-util", + "itoa 1.0.9", + "maud_macros", +] + +[[package]] +name = "maud_macros" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0be95d66c3024ffce639216058e5bae17a83ecaf266ffc6e4d060ad447c9eed2" +dependencies = [ + "proc-macro-error", + "proc-macro2 1.0.69", + "quote 1.0.33", + "syn 1.0.109", +] + [[package]] name = "maybe-uninit" version = "2.0.0" @@ -1921,7 +1946,7 @@ dependencies = [ "crossbeam-utils 0.8.16", "dashmap", "skeptic", - "smallvec 1.11.1", + "smallvec 1.11.2", "tagptr", "triomphe", ] @@ -2174,7 +2199,7 @@ dependencies = [ "phf 0.10.1", "phf_codegen 0.10.0", "precomputed-hash", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -2222,7 +2247,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.4.1", - "smallvec 1.11.1", + "smallvec 1.11.2", "windows-targets", ] @@ -2263,51 +2288,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" -[[package]] -name = "pest" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2 1.0.69", - "quote 1.0.33", - "syn 2.0.39", -] - -[[package]] -name = "pest_meta" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" -dependencies = [ - "once_cell", - "pest", - "sha2", -] - [[package]] name = "phf" version = "0.7.24" @@ -2482,6 +2462,30 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2 1.0.69", + "quote 1.0.33", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2 1.0.69", + "quote 1.0.33", + "version_check", +] + [[package]] name = "proc-macro2" version = "0.4.30" @@ -2725,7 +2729,7 @@ dependencies = [ "percent-encoding 2.3.0", "pin-project-lite", "ryu", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-retry", "tokio-util", "url 2.4.1", @@ -2820,8 +2824,8 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.21", - "http 0.2.9", + "h2 0.3.22", + "http 0.2.11", "http-body 0.4.5", "hyper 0.14.27", "hyper-rustls", @@ -2838,7 +2842,7 @@ dependencies = [ "serde_json", "serde_urlencoded 0.7.1", "system-configuration", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-rustls", "tower-service", "url 2.4.1", @@ -2895,9 +2899,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "9ad981d6c340a49cdc40a1028d9c6084ec7e9fa33fcb839cab656a267071e234" dependencies = [ "bitflags 2.4.1", "errno", @@ -2908,9 +2912,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.8" +version = "0.21.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", "ring", @@ -2920,9 +2924,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64 0.21.5", ] @@ -3053,7 +3057,7 @@ dependencies = [ "phf_codegen 0.10.0", "precomputed-hash", "servo_arc", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -3155,17 +3159,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "digest", -] - [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -3222,9 +3215,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" dependencies = [ "serde", ] @@ -3436,26 +3429,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "thiserror" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" -dependencies = [ - "proc-macro2 1.0.69", - "quote 1.0.33", - "syn 2.0.39", -] - [[package]] name = "thousands" version = "0.2.0" @@ -3548,9 +3521,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes 1.5.0", @@ -3609,9 +3582,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -3645,7 +3618,7 @@ checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" dependencies = [ "pin-project", "rand 0.8.5", - "tokio 1.33.0", + "tokio 1.34.0", ] [[package]] @@ -3655,7 +3628,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", - "tokio 1.33.0", + "tokio 1.34.0", ] [[package]] @@ -3721,7 +3694,7 @@ dependencies = [ "futures-core", "futures-sink", "pin-project-lite", - "tokio 1.33.0", + "tokio 1.34.0", "tracing", ] @@ -3787,12 +3760,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - [[package]] name = "unicase" version = "2.7.0" @@ -4022,7 +3989,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "websurfx" -version = "1.2.25" +version = "1.2.26" dependencies = [ "actix-cors", "actix-files", @@ -4036,9 +4003,9 @@ dependencies = [ "error-stack", "fake-useragent", "futures 0.3.29", - "handlebars", "lightningcss", "log", + "maud", "md5", "mimalloc", "mini-moka", @@ -4051,9 +4018,9 @@ dependencies = [ "scraper", "serde", "serde_json", - "smallvec 1.11.1", + "smallvec 1.11.2", "tempfile", - "tokio 1.33.0", + "tokio 1.34.0", ] [[package]] @@ -4208,18 +4175,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.25" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" +checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.25" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" +checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", diff --git a/Cargo.toml b/Cargo.toml index 3df6855..ffae799 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.2.25" +version = "1.2.26" 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 dc5fa842c0a74f9b7660d300a8aad2e57657671b Mon Sep 17 00:00:00 2001 From: S Dheeraj <97402083+SaranaDheeraj@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:09:34 +0530 Subject: [PATCH 30/39] #385 issue resolved replaced md5 hashing algorithm with sha-256 hashing algorithm --- Cargo.toml | 2 +- src/cache/redis_cacher.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 82e88b1..daa44da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ env_logger = {version="0.10.0", default-features=false} log = {version="0.4.20", default-features=false} mlua = {version="0.9.1", features=["luajit", "vendored"], default-features=false} redis = {version="0.23.3", features=["tokio-comp","connection-manager"], default-features = false, optional = true} -md5 = {version="0.7.0", default-features=false} +sha256 = {version="1.4.0", default-features=false} error-stack = {version="0.4.0", default-features=false, features=["std"]} async-trait = {version="0.1.73", default-features=false} regex = {version="1.9.4", features=["perf"], default-features = false} diff --git a/src/cache/redis_cacher.rs b/src/cache/redis_cacher.rs index e90344f..72090da 100644 --- a/src/cache/redis_cacher.rs +++ b/src/cache/redis_cacher.rs @@ -3,7 +3,7 @@ use error_stack::Report; use futures::future::try_join_all; -use md5::compute; +use sha256::digest; use redis::{aio::ConnectionManager, AsyncCommands, Client, RedisError}; use super::error::CacheError; From 89542072c8fc66977c950f8396c0dda638c0a365 Mon Sep 17 00:00:00 2001 From: S Dheeraj <97402083+SaranaDheeraj@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:53:30 +0530 Subject: [PATCH 31/39] Updated redis_cacher.rs --- src/cache/redis_cacher.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache/redis_cacher.rs b/src/cache/redis_cacher.rs index 72090da..c3d14a0 100644 --- a/src/cache/redis_cacher.rs +++ b/src/cache/redis_cacher.rs @@ -59,7 +59,7 @@ impl RedisCache { /// /// * `url` - It takes an url as string. fn hash_url(&self, url: &str) -> String { - format!("{:?}", compute(url)) + digest(url) } /// A function which fetches the cached json results as json string from the redis server. From 05bf05b0dd6614869942ef751b3607c701fe1cef Mon Sep 17 00:00:00 2001 From: neon_arch Date: Mon, 20 Nov 2023 15:11:58 +0300 Subject: [PATCH 32/39] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20build:=20enable=20gz?= =?UTF-8?q?ip=20and=20brotli=20features=20for=20the=20reqwest=20crate=20(#?= =?UTF-8?q?384)?= 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 82e88b1..74034fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ bench = false path = "src/bin/websurfx.rs" [dependencies] -reqwest = {version="0.11.22", default-features=false, features=["rustls-tls"]} +reqwest = {version="0.11.22", default-features=false, features=["rustls-tls","brotli", "gzip"]} tokio = {version="1.32.0",features=["rt-multi-thread","macros"], default-features = false} serde = {version="1.0.190", default-features=false, features=["derive"]} serde_json = {version="1.0.108", default-features=false} From b42adaa5a3c5946ff8cb75a5f0136e3130e99685 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Mon, 20 Nov 2023 15:27:49 +0300 Subject: [PATCH 33/39] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf:=20rewrite=20th?= =?UTF-8?q?e=20code=20by=20using=20a=20constant=20storing=20a=20prebuilt?= =?UTF-8?q?=20client=20globally=20for=20each=20thread=20(#384)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/engine_models.rs | 10 +++++----- src/results/aggregator.rs | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/models/engine_models.rs b/src/models/engine_models.rs index 98367e8..f8e966e 100644 --- a/src/models/engine_models.rs +++ b/src/models/engine_models.rs @@ -3,7 +3,8 @@ use super::aggregation_models::SearchResult; use error_stack::{Report, Result, ResultExt}; -use std::{collections::HashMap, fmt, time::Duration}; +use reqwest::Client; +use std::{collections::HashMap, fmt}; /// A custom error type used for handle engine associated errors. #[derive(Debug)] @@ -71,12 +72,11 @@ pub trait SearchEngine: Sync + Send { &self, url: &str, header_map: reqwest::header::HeaderMap, - request_timeout: u8, + client: &Client, ) -> Result { // fetch the html from upstream search engine - Ok(reqwest::Client::new() + Ok(client .get(url) - .timeout(Duration::from_secs(request_timeout as u64)) // Add timeout to request to avoid DDOSing the server .headers(header_map) // add spoofed headers to emulate human behavior .send() .await @@ -109,7 +109,7 @@ pub trait SearchEngine: Sync + Send { query: &str, page: u32, user_agent: &str, - request_timeout: u8, + client: &Client, safe_search: u8, ) -> Result, EngineError>; } diff --git a/src/results/aggregator.rs b/src/results/aggregator.rs index b57768f..3285786 100644 --- a/src/results/aggregator.rs +++ b/src/results/aggregator.rs @@ -9,6 +9,7 @@ use crate::models::{ }; use error_stack::Report; use regex::Regex; +use reqwest::{Client, ClientBuilder}; use std::time::{SystemTime, UNIX_EPOCH}; use std::{ collections::HashMap, @@ -18,6 +19,9 @@ use std::{ use std::{fs::File, io::BufRead}; use tokio::task::JoinHandle; +/// A constant for holding the prebuilt Client globally in the app. +static CLIENT: std::sync::OnceLock = std::sync::OnceLock::new(); + /// Aliases for long type annotations type FutureVec = Vec, Report>>>; @@ -68,6 +72,16 @@ pub async fn aggregate( request_timeout: u8, safe_search: u8, ) -> Result> { + let client = CLIENT.get_or_init(|| { + ClientBuilder::new() + .timeout(Duration::from_secs(request_timeout as u64)) // Add timeout to request to avoid DDOSing the server + .https_only(true) + .gzip(true) + .brotli(true) + .build() + .unwrap() + }); + let user_agent: &str = random_user_agent(); // Add a random delay before making the request. @@ -88,7 +102,7 @@ pub async fn aggregate( let query: String = query.to_owned(); tasks.push(tokio::spawn(async move { search_engine - .results(&query, page, user_agent, request_timeout, safe_search) + .results(&query, page, user_agent, client, safe_search) .await })); } From fe74f2eef7f1ec01468443d501662433ca46a06a Mon Sep 17 00:00:00 2001 From: neon_arch Date: Mon, 20 Nov 2023 15:30:00 +0300 Subject: [PATCH 34/39] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20code=20t?= =?UTF-8?q?o=20take=20prebuilt=20client=20to=20request=20search=20results?= =?UTF-8?q?=20(#384)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/engines/brave.rs | 6 +++--- src/engines/duckduckgo.rs | 5 +++-- src/engines/searx.rs | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/engines/brave.rs b/src/engines/brave.rs index 5c7c126..49626e3 100644 --- a/src/engines/brave.rs +++ b/src/engines/brave.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; -use reqwest::header::HeaderMap; +use reqwest::{header::HeaderMap, Client}; use scraper::Html; use crate::models::aggregation_models::SearchResult; @@ -42,7 +42,7 @@ impl SearchEngine for Brave { query: &str, page: u32, user_agent: &str, - request_timeout: u8, + client: &Client, safe_search: u8, ) -> Result, EngineError> { let url = format!("https://search.brave.com/search?q={query}&offset={page}"); @@ -68,7 +68,7 @@ impl SearchEngine for Brave { .change_context(EngineError::UnexpectedError)?; let document: Html = Html::parse_document( - &Brave::fetch_html_from_upstream(self, &url, header_map, request_timeout).await?, + &Brave::fetch_html_from_upstream(self, &url, header_map, client).await?, ); if let Some(no_result_msg) = self.parser.parse_for_no_results(&document).nth(0) { diff --git a/src/engines/duckduckgo.rs b/src/engines/duckduckgo.rs index 352a33b..fadddb6 100644 --- a/src/engines/duckduckgo.rs +++ b/src/engines/duckduckgo.rs @@ -5,6 +5,7 @@ use std::collections::HashMap; use reqwest::header::HeaderMap; +use reqwest::Client; use scraper::Html; use crate::models::aggregation_models::SearchResult; @@ -44,7 +45,7 @@ impl SearchEngine for DuckDuckGo { query: &str, page: u32, user_agent: &str, - request_timeout: u8, + client: &Client, _safe_search: u8, ) -> Result, EngineError> { // Page number can be missing or empty string and so appropriate handling is required @@ -76,7 +77,7 @@ impl SearchEngine for DuckDuckGo { .change_context(EngineError::UnexpectedError)?; let document: Html = Html::parse_document( - &DuckDuckGo::fetch_html_from_upstream(self, &url, header_map, request_timeout).await?, + &DuckDuckGo::fetch_html_from_upstream(self, &url, header_map, client).await?, ); if self.parser.parse_for_no_results(&document).next().is_some() { diff --git a/src/engines/searx.rs b/src/engines/searx.rs index 79c1e95..7bf0431 100644 --- a/src/engines/searx.rs +++ b/src/engines/searx.rs @@ -3,6 +3,7 @@ //! number if provided. use reqwest::header::HeaderMap; +use reqwest::Client; use scraper::Html; use std::collections::HashMap; @@ -40,7 +41,7 @@ impl SearchEngine for Searx { query: &str, page: u32, user_agent: &str, - request_timeout: u8, + client: &Client, mut safe_search: u8, ) -> Result, EngineError> { // Page number can be missing or empty string and so appropriate handling is required @@ -68,7 +69,7 @@ impl SearchEngine for Searx { .change_context(EngineError::UnexpectedError)?; let document: Html = Html::parse_document( - &Searx::fetch_html_from_upstream(self, &url, header_map, request_timeout).await?, + &Searx::fetch_html_from_upstream(self, &url, header_map, client).await?, ); if let Some(no_result_msg) = self.parser.parse_for_no_results(&document).nth(1) { From a46a2231c33e0b249bedaa6b5759154fadf2d303 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Mon, 20 Nov 2023 15:32:24 +0300 Subject: [PATCH 35/39] =?UTF-8?q?=F0=9F=94=96=20chore:=20bump=20the=20app?= =?UTF-8?q?=20version=20(#384)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 218 +++++++++++++++++++++++++++++++++++------------------ Cargo.toml | 2 +- 2 files changed, 144 insertions(+), 76 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c308b5..c9aa95f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,7 +14,7 @@ dependencies = [ "futures-sink", "memchr", "pin-project-lite", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-util", "tracing", ] @@ -31,7 +31,7 @@ dependencies = [ "futures-util", "log", "once_cell", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -87,7 +87,7 @@ dependencies = [ "derive_more", "encoding_rs", "futures-core", - "http 0.2.9", + "http 0.2.11", "httparse", "httpdate", "itoa 1.0.9", @@ -98,8 +98,8 @@ dependencies = [ "pin-project-lite", "rand 0.8.5", "sha1", - "smallvec 1.11.1", - "tokio 1.33.0", + "smallvec 1.11.2", + "tokio 1.34.0", "tokio-util", "tracing", ] @@ -121,7 +121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" dependencies = [ "bytestring", - "http 0.2.9", + "http 0.2.11", "regex", "serde", "tracing", @@ -134,7 +134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" dependencies = [ "futures-core", - "tokio 1.33.0", + "tokio 1.34.0", ] [[package]] @@ -150,7 +150,7 @@ dependencies = [ "futures-util", "mio 0.8.9", "socket2 0.5.5", - "tokio 1.33.0", + "tokio 1.34.0", "tracing", ] @@ -209,7 +209,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded 0.7.1", - "smallvec 1.11.1", + "smallvec 1.11.2", "socket2 0.5.5", "time 0.3.30", "url 2.4.1", @@ -284,6 +284,21 @@ dependencies = [ "memchr", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "anes" version = "0.1.6" @@ -314,6 +329,20 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" +[[package]] +name = "async-compression" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc2d0cfb2a7388d34f590e76686704c494ed7aaceed62ee1ba35cbf363abc2a5" +dependencies = [ + "brotli", + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio 1.34.0", +] + [[package]] name = "async-once-cell" version = "0.5.3" @@ -413,10 +442,31 @@ dependencies = [ ] [[package]] -name = "bstr" -version = "1.7.0" +name = "brotli" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bstr" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" dependencies = [ "memchr", "serde", @@ -477,9 +527,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" +checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" dependencies = [ "serde", ] @@ -562,18 +612,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" dependencies = [ "anstyle", "clap_lex", @@ -604,7 +654,7 @@ dependencies = [ "futures-core", "memchr", "pin-project-lite", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-util", ] @@ -828,7 +878,7 @@ dependencies = [ "dtoa-short", "itoa 1.0.9", "phf 0.11.2", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -841,7 +891,7 @@ dependencies = [ "dtoa-short", "itoa 1.0.9", "phf 0.11.2", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -974,9 +1024,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ "log", ] @@ -988,14 +1038,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059" dependencies = [ "fsio", - "indexmap", + "indexmap 1.9.3", ] [[package]] -name = "errno" -version = "0.3.6" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", "windows-sys", @@ -1314,7 +1370,7 @@ dependencies = [ "parking_lot 0.12.1", "quanta", "rand 0.8.5", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -1328,7 +1384,7 @@ dependencies = [ "fnv", "futures 0.1.31", "http 0.1.21", - "indexmap", + "indexmap 1.9.3", "log", "slab", "string", @@ -1337,19 +1393,19 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes 1.5.0", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.9", - "indexmap", + "http 0.2.11", + "indexmap 2.1.0", "slab", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-util", "tracing", ] @@ -1362,9 +1418,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "handlebars" -version = "4.4.0" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" +checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" dependencies = [ "log", "pest", @@ -1453,9 +1509,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes 1.5.0", "fnv", @@ -1481,7 +1537,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes 1.5.0", - "http 0.2.9", + "http 0.2.11", "pin-project-lite", ] @@ -1543,15 +1599,15 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.21", - "http 0.2.9", + "h2 0.3.22", + "http 0.2.11", "http-body 0.4.5", "httparse", "httpdate", "itoa 1.0.9", "pin-project-lite", "socket2 0.4.10", - "tokio 1.33.0", + "tokio 1.34.0", "tower-service", "tracing", "want 0.3.1", @@ -1564,10 +1620,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.9", + "http 0.2.11", "hyper 0.14.27", "rustls", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-rustls", ] @@ -1626,6 +1682,16 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.2", +] + [[package]] name = "iovec" version = "0.1.4" @@ -1737,7 +1803,7 @@ dependencies = [ "parcel_selectors", "paste", "pathdiff", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -1921,7 +1987,7 @@ dependencies = [ "crossbeam-utils 0.8.16", "dashmap", "skeptic", - "smallvec 1.11.1", + "smallvec 1.11.2", "tagptr", "triomphe", ] @@ -2174,7 +2240,7 @@ dependencies = [ "phf 0.10.1", "phf_codegen 0.10.0", "precomputed-hash", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -2222,7 +2288,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.4.1", - "smallvec 1.11.1", + "smallvec 1.11.2", "windows-targets", ] @@ -2725,7 +2791,7 @@ dependencies = [ "percent-encoding 2.3.0", "pin-project-lite", "ryu", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-retry", "tokio-util", "url 2.4.1", @@ -2815,13 +2881,14 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ + "async-compression", "base64 0.21.5", "bytes 1.5.0", "encoding_rs", "futures-core", "futures-util", - "h2 0.3.21", - "http 0.2.9", + "h2 0.3.22", + "http 0.2.11", "http-body 0.4.5", "hyper 0.14.27", "hyper-rustls", @@ -2838,8 +2905,9 @@ dependencies = [ "serde_json", "serde_urlencoded 0.7.1", "system-configuration", - "tokio 1.33.0", + "tokio 1.34.0", "tokio-rustls", + "tokio-util", "tower-service", "url 2.4.1", "wasm-bindgen", @@ -2895,9 +2963,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", @@ -2908,9 +2976,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.8" +version = "0.21.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", "ring", @@ -2920,9 +2988,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64 0.21.5", ] @@ -3053,7 +3121,7 @@ dependencies = [ "phf_codegen 0.10.0", "precomputed-hash", "servo_arc", - "smallvec 1.11.1", + "smallvec 1.11.2", ] [[package]] @@ -3222,9 +3290,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" dependencies = [ "serde", ] @@ -3548,9 +3616,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes 1.5.0", @@ -3609,9 +3677,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -3645,7 +3713,7 @@ checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" dependencies = [ "pin-project", "rand 0.8.5", - "tokio 1.33.0", + "tokio 1.34.0", ] [[package]] @@ -3655,7 +3723,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", - "tokio 1.33.0", + "tokio 1.34.0", ] [[package]] @@ -3721,7 +3789,7 @@ dependencies = [ "futures-core", "futures-sink", "pin-project-lite", - "tokio 1.33.0", + "tokio 1.34.0", "tracing", ] @@ -4022,7 +4090,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "websurfx" -version = "1.2.25" +version = "1.2.27" dependencies = [ "actix-cors", "actix-files", @@ -4051,9 +4119,9 @@ dependencies = [ "scraper", "serde", "serde_json", - "smallvec 1.11.1", + "smallvec 1.11.2", "tempfile", - "tokio 1.33.0", + "tokio 1.34.0", ] [[package]] @@ -4208,18 +4276,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.25" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" +checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.25" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" +checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", diff --git a/Cargo.toml b/Cargo.toml index 74034fe..3e33021 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.2.25" +version = "1.2.27" 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 f62b8214228755dbaede59eef2621c2b7001828b Mon Sep 17 00:00:00 2001 From: alamin655 Date: Mon, 20 Nov 2023 21:05:57 +0530 Subject: [PATCH 36/39] =?UTF-8?q?=F0=9F=94=96=20chore:=20bump=20the=20app?= =?UTF-8?q?=20version=20(#386)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5b77a3f..f854b37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.2.26" +version = "1.2.28" 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" @@ -27,7 +27,7 @@ env_logger = {version="0.10.0", default-features=false} log = {version="0.4.20", default-features=false} mlua = {version="0.9.1", features=["luajit", "vendored"], default-features=false} redis = {version="0.23.3", features=["tokio-comp","connection-manager"], default-features = false, optional = true} -sha256 = {version="1.4.0", default-features=false} +blake3 = {version="1.5.0", default-features=false} error-stack = {version="0.4.0", default-features=false, features=["std"]} async-trait = {version="0.1.73", default-features=false} regex = {version="1.9.4", features=["perf"], default-features = false} From a2360d1f656f12b6f9c319f8d95ad920c347f80c Mon Sep 17 00:00:00 2001 From: alamin655 Date: Mon, 20 Nov 2023 21:06:51 +0530 Subject: [PATCH 37/39] =?UTF-8?q?=F0=9F=94=96=20chore:=20bump=20the=20app?= =?UTF-8?q?=20version=20(#386)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 340 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 199 insertions(+), 141 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6b5ae5..2cd3055 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,7 +14,7 @@ dependencies = [ "futures-sink", "memchr", "pin-project-lite", - "tokio 1.34.0", + "tokio 1.33.0", "tokio-util", "tracing", ] @@ -31,7 +31,7 @@ dependencies = [ "futures-util", "log", "once_cell", - "smallvec 1.11.2", + "smallvec 1.11.1", ] [[package]] @@ -87,7 +87,7 @@ dependencies = [ "derive_more", "encoding_rs", "futures-core", - "http 0.2.11", + "http 0.2.9", "httparse", "httpdate", "itoa 1.0.9", @@ -98,8 +98,8 @@ dependencies = [ "pin-project-lite", "rand 0.8.5", "sha1", - "smallvec 1.11.2", - "tokio 1.34.0", + "smallvec 1.11.1", + "tokio 1.33.0", "tokio-util", "tracing", ] @@ -121,7 +121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" dependencies = [ "bytestring", - "http 0.2.11", + "http 0.2.9", "regex", "serde", "tracing", @@ -134,7 +134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" dependencies = [ "futures-core", - "tokio 1.34.0", + "tokio 1.33.0", ] [[package]] @@ -150,7 +150,7 @@ dependencies = [ "futures-util", "mio 0.8.9", "socket2 0.5.5", - "tokio 1.34.0", + "tokio 1.33.0", "tracing", ] @@ -209,7 +209,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded 0.7.1", - "smallvec 1.11.2", + "smallvec 1.11.1", "socket2 0.5.5", "time 0.3.30", "url 2.4.1", @@ -308,6 +308,18 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "askama_escape" version = "0.10.3" @@ -403,6 +415,19 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +[[package]] +name = "blake3" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if 1.0.0", + "constant_time_eq", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -414,9 +439,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.8.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" dependencies = [ "memchr", "serde", @@ -562,18 +587,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.8" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.8" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstyle", "clap_lex", @@ -604,7 +629,7 @@ dependencies = [ "futures-core", "memchr", "pin-project-lite", - "tokio 1.34.0", + "tokio 1.33.0", "tokio-util", ] @@ -628,6 +653,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + [[package]] name = "convert_case" version = "0.4.0" @@ -828,7 +859,7 @@ dependencies = [ "dtoa-short", "itoa 1.0.9", "phf 0.11.2", - "smallvec 1.11.2", + "smallvec 1.11.1", ] [[package]] @@ -841,7 +872,7 @@ dependencies = [ "dtoa-short", "itoa 1.0.9", "phf 0.11.2", - "smallvec 1.11.2", + "smallvec 1.11.1", ] [[package]] @@ -974,9 +1005,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" dependencies = [ "log", ] @@ -988,20 +1019,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059" dependencies = [ "fsio", - "indexmap 1.9.3", + "indexmap", ] -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - [[package]] name = "errno" -version = "0.3.7" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" dependencies = [ "libc", "windows-sys", @@ -1320,7 +1345,7 @@ dependencies = [ "parking_lot 0.12.1", "quanta", "rand 0.8.5", - "smallvec 1.11.2", + "smallvec 1.11.1", ] [[package]] @@ -1334,7 +1359,7 @@ dependencies = [ "fnv", "futures 0.1.31", "http 0.1.21", - "indexmap 1.9.3", + "indexmap", "log", "slab", "string", @@ -1343,19 +1368,19 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes 1.5.0", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.11", - "indexmap 2.1.0", + "http 0.2.9", + "indexmap", "slab", - "tokio 1.34.0", + "tokio 1.33.0", "tokio-util", "tracing", ] @@ -1366,6 +1391,21 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +[[package]] +name = "handlebars" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", + "walkdir", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1444,9 +1484,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes 1.5.0", "fnv", @@ -1472,7 +1512,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes 1.5.0", - "http 0.2.11", + "http 0.2.9", "pin-project-lite", ] @@ -1534,15 +1574,15 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.22", - "http 0.2.11", + "h2 0.3.21", + "http 0.2.9", "http-body 0.4.5", "httparse", "httpdate", "itoa 1.0.9", "pin-project-lite", "socket2 0.4.10", - "tokio 1.34.0", + "tokio 1.33.0", "tower-service", "tracing", "want 0.3.1", @@ -1555,10 +1595,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.11", + "http 0.2.9", "hyper 0.14.27", "rustls", - "tokio 1.34.0", + "tokio 1.33.0", "tokio-rustls", ] @@ -1617,16 +1657,6 @@ dependencies = [ "hashbrown 0.12.3", ] -[[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown 0.14.2", -] - [[package]] name = "iovec" version = "0.1.4" @@ -1738,7 +1768,7 @@ dependencies = [ "parcel_selectors", "paste", "pathdiff", - "smallvec 1.11.2", + "smallvec 1.11.1", ] [[package]] @@ -1860,42 +1890,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" -[[package]] -name = "maud" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0bab19cef8a7fe1c18a43e881793bfc9d4ea984befec3ae5bd0415abf3ecf00" -dependencies = [ - "actix-web", - "futures-util", - "itoa 1.0.9", - "maud_macros", -] - -[[package]] -name = "maud_macros" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0be95d66c3024ffce639216058e5bae17a83ecaf266ffc6e4d060ad447c9eed2" -dependencies = [ - "proc-macro-error", - "proc-macro2 1.0.69", - "quote 1.0.33", - "syn 1.0.109", -] - [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -[[package]] -name = "md5" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" - [[package]] name = "memchr" version = "2.6.4" @@ -1946,7 +1946,7 @@ dependencies = [ "crossbeam-utils 0.8.16", "dashmap", "skeptic", - "smallvec 1.11.2", + "smallvec 1.11.1", "tagptr", "triomphe", ] @@ -2199,7 +2199,7 @@ dependencies = [ "phf 0.10.1", "phf_codegen 0.10.0", "precomputed-hash", - "smallvec 1.11.2", + "smallvec 1.11.1", ] [[package]] @@ -2247,7 +2247,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.4.1", - "smallvec 1.11.2", + "smallvec 1.11.1", "windows-targets", ] @@ -2288,6 +2288,51 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +[[package]] +name = "pest" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2 1.0.69", + "quote 1.0.33", + "syn 2.0.39", +] + +[[package]] +name = "pest_meta" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "phf" version = "0.7.24" @@ -2462,30 +2507,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2 1.0.69", - "quote 1.0.33", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2 1.0.69", - "quote 1.0.33", - "version_check", -] - [[package]] name = "proc-macro2" version = "0.4.30" @@ -2729,7 +2750,7 @@ dependencies = [ "percent-encoding 2.3.0", "pin-project-lite", "ryu", - "tokio 1.34.0", + "tokio 1.33.0", "tokio-retry", "tokio-util", "url 2.4.1", @@ -2824,8 +2845,8 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.22", - "http 0.2.11", + "h2 0.3.21", + "http 0.2.9", "http-body 0.4.5", "hyper 0.14.27", "hyper-rustls", @@ -2842,7 +2863,7 @@ dependencies = [ "serde_json", "serde_urlencoded 0.7.1", "system-configuration", - "tokio 1.34.0", + "tokio 1.33.0", "tokio-rustls", "tower-service", "url 2.4.1", @@ -2899,9 +2920,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.24" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ad981d6c340a49cdc40a1028d9c6084ec7e9fa33fcb839cab656a267071e234" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", "errno", @@ -2912,9 +2933,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.9" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", "ring", @@ -2924,9 +2945,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ "base64 0.21.5", ] @@ -3057,7 +3078,7 @@ dependencies = [ "phf_codegen 0.10.0", "precomputed-hash", "servo_arc", - "smallvec 1.11.2", + "smallvec 1.11.1", ] [[package]] @@ -3159,6 +3180,17 @@ dependencies = [ "digest", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -3215,9 +3247,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" dependencies = [ "serde", ] @@ -3429,6 +3461,26 @@ dependencies = [ "utf-8", ] +[[package]] +name = "thiserror" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +dependencies = [ + "proc-macro2 1.0.69", + "quote 1.0.33", + "syn 2.0.39", +] + [[package]] name = "thousands" version = "0.2.0" @@ -3521,9 +3573,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.34.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes 1.5.0", @@ -3582,9 +3634,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -3618,7 +3670,7 @@ checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" dependencies = [ "pin-project", "rand 0.8.5", - "tokio 1.34.0", + "tokio 1.33.0", ] [[package]] @@ -3628,7 +3680,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", - "tokio 1.34.0", + "tokio 1.33.0", ] [[package]] @@ -3694,7 +3746,7 @@ dependencies = [ "futures-core", "futures-sink", "pin-project-lite", - "tokio 1.34.0", + "tokio 1.33.0", "tracing", ] @@ -3760,6 +3812,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + [[package]] name = "unicase" version = "2.7.0" @@ -3989,7 +4047,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "websurfx" -version = "1.2.26" +version = "1.2.28" dependencies = [ "actix-cors", "actix-files", @@ -3997,16 +4055,16 @@ dependencies = [ "actix-web", "async-once-cell", "async-trait", + "blake3", "criterion", "dhat", "env_logger", "error-stack", "fake-useragent", "futures 0.3.29", + "handlebars", "lightningcss", "log", - "maud", - "md5", "mimalloc", "mini-moka", "minify-js", @@ -4018,9 +4076,9 @@ dependencies = [ "scraper", "serde", "serde_json", - "smallvec 1.11.2", + "smallvec 1.11.1", "tempfile", - "tokio 1.34.0", + "tokio 1.33.0", ] [[package]] @@ -4175,18 +4233,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.26" +version = "0.7.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" +checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.26" +version = "0.7.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" +checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", From fc830c4683c7b0d9a325a60e869597aba59a6f5b Mon Sep 17 00:00:00 2001 From: alamin655 Date: Mon, 20 Nov 2023 21:09:27 +0530 Subject: [PATCH 38/39] Update redis_cacher.rs --- src/cache/redis_cacher.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cache/redis_cacher.rs b/src/cache/redis_cacher.rs index c3d14a0..b638fa4 100644 --- a/src/cache/redis_cacher.rs +++ b/src/cache/redis_cacher.rs @@ -3,7 +3,7 @@ use error_stack::Report; use futures::future::try_join_all; -use sha256::digest; +use blake3::hash; use redis::{aio::ConnectionManager, AsyncCommands, Client, RedisError}; use super::error::CacheError; @@ -59,7 +59,7 @@ impl RedisCache { /// /// * `url` - It takes an url as string. fn hash_url(&self, url: &str) -> String { - digest(url) + format!("{:?}", blake3::hash(url.as_bytes())) } /// A function which fetches the cached json results as json string from the redis server. From abc59b285875c3bfbff6908b6bd8d4af37d8d3a6 Mon Sep 17 00:00:00 2001 From: alamin655 Date: Mon, 20 Nov 2023 21:38:20 +0530 Subject: [PATCH 39/39] =?UTF-8?q?=F0=9F=A7=B9=20chore:=20make=20clippy=20h?= =?UTF-8?q?appy=20(#386)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cache/redis_cacher.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache/redis_cacher.rs b/src/cache/redis_cacher.rs index b638fa4..0e8ec38 100644 --- a/src/cache/redis_cacher.rs +++ b/src/cache/redis_cacher.rs @@ -1,9 +1,9 @@ //! This module provides the functionality to cache the aggregated results fetched and aggregated //! from the upstream search engines in a json format. +use blake3::hash; use error_stack::Report; use futures::future::try_join_all; -use blake3::hash; use redis::{aio::ConnectionManager, AsyncCommands, Client, RedisError}; use super::error::CacheError;