From 493696f4e2bc514f8139291e9ca52dd8442014e6 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 23 Dec 2023 00:09:11 +0300 Subject: [PATCH 01/32] =?UTF-8?q?=F0=9F=93=9D=20docs:=20update=20the=20pro?= =?UTF-8?q?ject=20structure=20and=20the=20associated=20explaination=20(#43?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/developing.md | 102 +++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/docs/developing.md b/docs/developing.md index c8752e6..dcf3eda 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -12,7 +12,7 @@ This page of the docs outlines how to get **Websurfx** up and running in a devel - [NixOS Dev Shell using Nix Flake](#nixos-dev-shell-using-nix-flake-) - [Local Development with Docker Compose](#local-development-with-docker-compose-) - [Project Commands](#project-commands) -+ - [Environment Variables](#environment-variables) + - [Environment Variables](#environment-variables) - [Git Strategy](#git-strategy) - [Flow](#git-flow) - [Branches](#git-branch-naming) @@ -57,7 +57,7 @@ $ npm i -g stylelint $ npm i -g stylelint stylelint-config-standard postcss-lit ``` -> **Note** +> [!Note] > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods. - `Cargo-watch` installed on your system which will allow you to auto-build the project when any checks occur in the source code files in the codebase (`websurfx` directory). Before you install `cargo-watch` on your system, make sure you have `cargo` installed on your system. To install `cargo-watch` run the following command: @@ -69,7 +69,7 @@ cargo install cargo-watch - `Git` installed on your system. The installation instructions for this can be found [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). - Finally, The latest version of `Docker` is installed on your system which will be used to avoid introducing unexpected issues when working on the project. The installation instructions for this can be found [here](https://docs.docker.com/engine/install/). -> **Note** +> [!Note] > For **rolling release Linux distributions (distros)**, the above-mentioned required packages except for `stylelint` and `cargo-watch` can also be installed via the distro-specific package manager. > > **For Example:** @@ -149,7 +149,7 @@ Once you have finished running the above command, Websurfx should now be served This section covers how to use and set up the Gitpod development environment for working on the project. -> **Note** +> [!Note] > By default the project only supports the Vscode **IDE/Editor** for Gitpod. #### Launching Gitpod @@ -310,13 +310,13 @@ Before you start working on the project. You will need the following packages in $ npm i -g stylelint ``` -> **Note** +> [!Note] > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods. - `Git` installed on your system. The installation instructions for this can be found [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). - Finally, The latest version of `Docker` is installed on your system which will be used to avoid introducing unexpected issues when working on the project. The installation instructions for this can be found [here](https://docs.docker.com/engine/install/). -> **Note** +> [!Note] > For **rolling release Linux distributions (distros)**, the above-mentioned all required packages can also be installed via the distro-specific package manager. > > **For Example:** @@ -355,7 +355,7 @@ If you have followed the above section then you should have a cloned repository $ docker compose -f dev.docker-compose.yml up ``` -> **Note** +> [!Note] > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods. Once you have finished running the above command, Websurfx should now be served on the address http://127.0.0.1:8080. Hot reload is enabled, so making changes to any of the files will trigger the project to be rebuilt. @@ -366,13 +366,12 @@ Once you have finished running the above command, Websurfx should now be served - `cargo build`: Builds the project. -> **Note** +> [!Note] > When you build the project first time with the above command it will require the app to compile every dependency in the project which will then be cached on your system. So when you compile the app next time it will only compile for the new changes. -+ `cargo run`: Starts the app and serves the project on http://127.0.0.1:8080. +- `cargo run`: Starts the app and serves the project on http://127.0.0.1:8080. - -> **Important** +> [!Important] > You must run the build command first. #### Development @@ -458,10 +457,10 @@ When you submit your pull request, include the required info, by filling out the - If any dependencies were added, explain why it was needed, and state the cost. associated, and confirm it does not introduce any security, privacy, or speed issues - Optionally, provide a checklist of all the changes that were included in the pull request. -> **Important** +> [!Important] > Make sure to fill all the required/mandatory sections of the pull request as filling them helps us distinguish between spam pull requests and legitimate pull requests. -> **Note** +> [!Note] > The pull request template contains comments in the following form `` which are used to provide a guide on what should be provided under each heading of the template. These comments are never rendered when the pull request is either created or updated and hence anything provided in such comments is never displayed. ## Resources for Beginners @@ -498,7 +497,7 @@ For Rust, CSS, JS, HTML, Git, and Docker- you'll need an IDE (e.g. [VSCode](http Linting is done using [Cargo Clippy](https://doc.rust-lang.org/clippy/) and [StyleLint](https://stylelint.io/) or [ESLint](https://eslint.org/). Also, linting is run as a git pre-commit hook. -> **Important** +> [!Important] > All lint checks must pass before any PR can be merged. Styleguides to follow: @@ -509,7 +508,7 @@ Styleguides to follow: ## Application Structure -> **Important** +> [!Important] > We follow the Unix style naming conventions for all the files and folders in the project (except for all files under the `themes` and `colorschemes` folder in the frontend's source code which requires that the names of the files and folders should be in lowercase and the words be separated with a hyphen.) which includes the name of the files and folders should be in lowercase and every word should be separated with an underscore. **Files in the root of the codebase:** `./` @@ -541,30 +540,42 @@ Styleguides to follow: ./public/ ├── robots.txt # Robots file for the Website. ├── images # Images for the Website. -├── static # The directory containing all the UI handlers. -│ ├── cookies.js # Handles the loading of saved cookies. -│ ├── error_box.js # Handles the toggling functionality of the error box on the search page. -│ ├── index.js # Functions to handle the search functionality of the search bar. -│ ├── pagination.js # Functions to handle the navigation between the previous and next page in the search page. -│ ├── search_area_options.js # Changes the search options under the search bar in the search page according to the safe search level set using the URL safesearch parameter. -│ ├── settings.js # Handles the settings and saving of all the settings page options as a cookie. -│ ├── colorschemes # A folder containing all the popular colorscheme files as CSS files. -│ └── themes # A folder containing all the popular theme files as CSS files. -└── templates # Folder containing all the template files for the different pages on the website. - ├── 404.html # A 404-page template. - ├── about.html # An about page template. - ├── bar.html # A template for the search bar. - ├── cookies_tab.html # A template for the cookies tab for the settings page. - ├── engines_tab.html # A template for the engines tab for the settings page. - ├── footer.html # A footer template for all pages. - ├── general_tab.html # A template for the general tab for the settings page. - ├── header.html # A header template for all pages. - ├── index.html # A home page template. - ├── navbar.html # A navbar template for the header template. - ├── search.html # A search page template. - ├── search_bar.html # A search bar template specifically for the search page. - ├── settings.html # A settings page template. - └── user_interface_tab.html # A template for the user interface tab for the settings page. +└── static # The directory containing all the UI handlers. + ├── cookies.js # Handles the loading of saved cookies. + ├── error_box.js # Handles the toggling functionality of the error box on the search page. + ├── index.js # Functions to handle the search functionality of the search bar. + ├── pagination.js # Functions to handle the navigation between the previous and next page in the search page. + ├── search_area_options.js # Changes the search options under the search bar in the search page according to the safe search level set using the URL safesearch parameter. + ├── settings.js # Handles the settings and saving of all the settings page options as a cookie. + ├── colorschemes # A folder containing all the popular colorscheme files as CSS files. + └── themes # A folder containing all the popular theme files as CSS files. +``` + +**Fronted Maud HTML Framework Source:** `./src/templates/` + +``` +./src/templates/ +├── mod.rs # A module file for the rust project. +├── partials # A folder containing the code for partials for the views. +│ ├── bar.rs # Provides partial code for the search bar. +│ ├── footer.rs # Provides partial code for the footer section. +│ ├── header.rs # Provides partial code for the header section. +│ ├── mod.rs # A module file for the rust project. +│ ├── navbar.rs # Provides partial code for the navbar inside the header section. +│ ├── search_bar.rs # Provides partial code for the search bar present in the search page. +│ └── settings_tabs # A folder containing all the partials for the settings page tabs. +│ ├── cookies.rs # Provides partial code for the cookies tab. +│ ├── engines.rs # Provides partial code for the engines tab. +│ ├── general.rs # Provides partial code for the general tab. +│ ├── mod.rs # A module file for the rust project. +│ └── user_interface.rs # Provides partial code for the user interface tab. +└── views # A folder containing the code for the views. + ├── about.rs # Provides code for the about page view. + ├── index.rs # Provides code for the homepage view. + ├── mod.rs # A module file for the rust project. + ├── not_found.rs # Provides code for the 404 page view. + ├── search.rs # Provides code for the search page view. + └── settings.rs # Provides code for the settings page view. ``` **Backend Source:** `./src/` @@ -601,12 +612,13 @@ Styleguides to follow: │ ├── aggregator.rs # Provides code aggregate and fetches results from the upstream engines. │ ├── mod.rs # A module file for the rust project. │ └── user_agent.rs # Provides a helper function to allow random user agents to pass in the server request code to improve user privacy and avoiding detected as a bot. -└── server # A folder that holds code to handle the routes for the search engine website. - ├── mod.rs # A module file for the rust project. - ├── router.rs # Provides functions to handle the different routes on the website. - └── routes # A folder that contains code to handle the bigger route for the website. - ├── mod.rs # A module file for the rust project. - └── search.rs # Provides the function to handle the search route. +├── server # A folder that holds code to handle the routes for the search engine website. +│ ├── mod.rs # A module file for the rust project. +│ ├── router.rs # Provides functions to handle the different routes on the website. +│ └── routes # A folder that contains code to handle the bigger route for the website. +│ ├── mod.rs # A module file for the rust project. +│ └── search.rs # Provides the function to handle the search route. +└── templates # A module that provides and handles Maud HTML framework source code for the search engine website (subfolders and files are explained in the above frontend section.) ``` ## Development Tools From a66362bce14538cedd3f08eb2372b2bf5063bfc4 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 23 Dec 2023 19:32:55 +0300 Subject: [PATCH 02/32] =?UTF-8?q?=F0=9F=93=9D=20docs:=20provide=20explanat?= =?UTF-8?q?ion=20for=20the=20new=20config=20file=20options=20(#439)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/configuration.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index cae0dfc..c237b5b 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -4,7 +4,7 @@ If you have built `websurfx` from the source then the configuration file will be located under the project directory (codebase) at `websurfx/` -> **Note** +> [!Note] > 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 @@ -48,7 +48,7 @@ Some of the configuration options provided in the file are stated below. These a ## Website -- **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). +- **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: > @@ -71,6 +71,12 @@ Some of the configuration options provided in the file are stated below. These a > > 1. simple +- **animation:** The animation name that should be used for the website (again, the name should be by the animation file name present in the `public/static/animations` folder). + +> By Default we provide 1 animation to choose from these are: +> +> 1. simple-frosted-glow + ## Cache - **redis_url:** Redis connection URL address on which the client should connect. @@ -78,6 +84,8 @@ Some of the configuration options provided in the file are stated below. These a > **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). +- **cache_expiry_time:** The maximum time the server will store the cache for, after which it flushs/removes/expires/invalidates the cached results. (value provided to this option should be in seconds and the value should be greater than or equal to 60 seconds). + ## Search Engines - **upstream_search_engines:** Select from the different upstream search engines from which the results should be fetched. From fb46d2c6f2dc3feccfb1abbf6dcab6355a4da718 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 23 Dec 2023 19:42:43 +0300 Subject: [PATCH 03/32] =?UTF-8?q?=F0=9F=93=9D=20docs:=20update=20the=20the?= =?UTF-8?q?me=20example=20&=20add=20a=20new=20animation=20section=20(#439)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/theming.md | 345 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 248 insertions(+), 97 deletions(-) diff --git a/docs/theming.md b/docs/theming.md index dd46a65..9a248a9 100644 --- a/docs/theming.md +++ b/docs/theming.md @@ -1,17 +1,25 @@ -# Colorschemes +# Theming -## Built-in +## Colorschemes -By default `websurfx` comes with 9 colorschemes to choose from which can be easily chosen using the config file. To how to change colorschemes please view the [Configuration](https://github.com/neon-mmd/websurfx/wiki/configuration) section of the wiki. +### Built-in -## Custom +By default `websurfx` comes with 12 colorschemes to choose from which can be easily chosen using the config file or via the settings page on the website. -Creating coloschemes is as easy as it gets it requires the user to have a theme file name with the colorscheme in which every space should be replaced with a `-` (dash) and it should end with a `.css` file extension. After creating the file you need to add the following code with the `colors` you want: +> To how to change colorschemes using the config file. See: [**Configuration**](https://github.com/neon-mmd/websurfx/wiki/configuration) + +### Custom + +To write a custom theme for the website, you will first need to create a new file under the `public/static/themes` folder with name of the theme containing each word seperated with a hyphen (**-**). Then after that edit the newly created file as required with new css code. + +Creating coloschemes is as easy as it gets it requires the user to have a colorscheme file name with the name of the colorscheme that is to be provided in which every space should be replaced with a `-` (dash) and it should end with a `.css` file extension. After creating the file you need to add the following code with the `colors` you want to include: ```css :root { --background-color: ; --foreground-color: ; + --logo-color: ; --color-one: ; --color-two: ; --color-three: ; @@ -22,7 +30,7 @@ Creating coloschemes is as easy as it gets it requires the user to have a theme } ``` -> **Note** +> [!Note] > Please infer the theme file located under `public/static/themes` to better understand where each color is being used. **Example of `catppuccin-mocha` colorscheme:** @@ -31,6 +39,7 @@ Creating coloschemes is as easy as it gets it requires the user to have a theme :root { --background-color: #1e1e2e; --foreground-color: #cdd6f4; + --logo-color: #f5c2e7; --color-one: #45475a; --color-two: #f38ba8; --color-three: #a6e3a1; @@ -41,21 +50,31 @@ Creating coloschemes is as easy as it gets it requires the user to have a theme } ``` -# Themes +## Themes -## Built-in +### Built-in -By default `websurfx` comes with 1 theme to choose from which can be easily chosen using the config file. To how to change themes please view the [Configuration](https://github.com/neon-mmd/websurfx/wiki/configuration) section of the wiki. +By default `websurfx` comes with 1 theme to choose from which can be easily chosen using the config file or via the settings page on the website. -## Custom +> To how to change themes using the config file. See: [**Configuration**](https://github.com/neon-mmd/websurfx/wiki/configuration) -To write custom color scheme, it requires the user to have some knowledge of `css stylesheets`. +### Custom -**Here is an example of `simple theme` (which we provide by default with the app) which will give the user a better idea on how to create a custom theme using it as a template:** +> This section expects the user to have some knowledge of `css`. -### General +To write a custom theme for the website, you will first need to create a new file under the `public/static/themes` folder with name of the theme containing each word seperated with a hyphen (**-**). Then after that edit the newly created file as required with new css code. + +Here is an example of `simple theme` (which we provide by default with the app) which will give you a better idea on how you can create your own custom theme for the website: + +#### General ```css +@font-face { + font-family: Rubik; + src: url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700;800&display=swap'); + fallback: sans-serif; +} + * { padding: 0; margin: 0; @@ -72,11 +91,17 @@ body { justify-content: space-between; align-items: center; height: 100vh; - background: var(--color-one); + font-family: Rubik, sans-serif; + background-color: var(--background-color); +} + +/* enforce font for buttons */ +button { + font-family: Rubik, sans-serif; } ``` -### Styles for the index page +#### Styles for the index page ```css .search-container { @@ -87,44 +112,69 @@ body { align-items: center; } +.search-container svg { + color: var(--logo-color); +} + .search-container div { display: flex; } ``` -### Styles for the search box and search button +#### Styles for the search box and search button ```css .search_bar { display: flex; + gap: 10px; + align-items: center; } .search_bar input { - padding: 1rem; + border-radius: 6px; + padding: 2.6rem 2.2rem; width: 50rem; height: 3rem; outline: none; border: none; - box-shadow: rgba(0, 0, 0, 1); - background: var(--foreground-color); + box-shadow: rgb(0 0 0 / 1); + background-color: var(--color-one); + color: var(--foreground-color); + outline-offset: 3px; + font-size: 1.6rem; +} + +.search_bar input:focus { + outline: 2px solid var(--foreground-color); +} + +.search_bar input::placeholder { + color: var(--foreground-color); + opacity: 1; } .search_bar button { - padding: 1rem; - border-radius: 0; + padding: 2.6rem 3.2rem; + border-radius: 6px; height: 3rem; display: flex; justify-content: center; align-items: center; - outline: none; + outline-offset: 3px; + outline: 2px solid transparent; border: none; + transition: 0.1s; gap: 0; - background: var(--background-color); - color: var(--color-three); + background-color: var(--color-six); + color: var(--background-color); font-weight: 600; letter-spacing: 0.1rem; } +.search_bar button:active { + outline: 2px solid var(--color-three); +} + .search_bar button:active, .search_bar button:hover { filter: brightness(1.2); @@ -141,13 +191,19 @@ body { width: 20rem; background-color: var(--color-one); color: var(--foreground-color); - padding: 1rem 2rem; + padding: 1.2rem 2rem; border-radius: 0.5rem; - outline: none; + outline-offset: 3px; + outline: 2px solid transparent; border: none; text-transform: capitalize; } +.search_area .search_options select:active, +.search_area .search_options select:hover { + outline: 2px solid var(--color-three); +} + .search_area .search_options option:hover { background-color: var(--color-one); } @@ -170,9 +226,7 @@ body { .result_not_found img { width: 40rem; } -``` -```css /* styles for the error box */ .error_box .error_box_toggle_button { background: var(--foreground-color); @@ -188,9 +242,11 @@ body { min-height: 20rem; min-width: 22rem; } + .error_box .dropdown_error_box.show { display: flex; } + .error_box .dropdown_error_box .error_item, .error_box .dropdown_error_box .no_errors { display: flex; @@ -200,22 +256,25 @@ body { padding: 1rem; font-size: 1.2rem; } + .error_box .dropdown_error_box .error_item { justify-content: space-between; } + .error_box .dropdown_error_box .no_errors { min-height: 18rem; justify-content: center; } .error_box .dropdown_error_box .error_item:hover { - box-shadow: inset 0 0 100px 100px rgba(255, 255, 255, 0.1); + box-shadow: inset 0 0 100px 100px rgb(255 255 255 / 0.1); } .error_box .error_item .severity_color { width: 1.2rem; height: 1.2rem; } + .results .result_disallowed, .results .result_filtered, .results .result_engine_not_selected { @@ -225,7 +284,7 @@ body { gap: 10rem; font-size: 2rem; color: var(--foreground-color); - margin: 0rem 7rem; + margin: 0 7rem; } .results .result_disallowed .user_query, @@ -251,16 +310,34 @@ body { } ``` -### Styles for the footer and header +#### Styles for the footer and header ```css header { - background: var(--background-color); width: 100%; + background: var(--background-color); display: flex; - justify-content: right; align-items: center; - padding: 1rem; + justify-content: space-between; + padding: 2rem 3rem; +} + +footer { + width: 100%; + background: var(--background-color); + display: flex; + align-items: center; + padding: 1.7rem 1.7rem 4rem; + gap: 1.8rem; + flex-direction: column; + justify-content: center; +} + +header h1 a { + text-transform: capitalize; + text-decoration: none; + color: var(--foreground-color); + letter-spacing: 0.1rem; } header ul, @@ -301,39 +378,9 @@ footer div { display: flex; gap: 1rem; } - -footer { - background: var(--background-color); - width: 100%; - padding: 1rem; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -footer div span { - font-size: 1.5rem; - color: var(--4); -} - -footer div { - display: flex; - gap: 1rem; -} - -footer { - background: var(--bg); - width: 100%; - padding: 1rem; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} ``` -### Styles for the search page +#### Styles for the search page ```css .results { @@ -341,6 +388,11 @@ footer { display: flex; flex-direction: column; justify-content: space-around; + gap: 1rem; +} + +.result { + gap: 1rem; } .results .search_bar { @@ -352,6 +404,7 @@ footer { flex-direction: column; justify-content: space-between; margin: 2rem 0; + content-visibility: auto; } .results_aggregated .result { @@ -361,10 +414,10 @@ footer { } .results_aggregated .result h1 a { - font-size: 1.5rem; + font-size: 1.7rem; + font-weight: normal; color: var(--color-two); text-decoration: none; - letter-spacing: 0.1rem; } .results_aggregated .result h1 a:hover { @@ -377,14 +430,15 @@ footer { .results_aggregated .result small { color: var(--color-three); - font-size: 1.1rem; + font-size: 1.3rem; word-wrap: break-word; line-break: anywhere; } .results_aggregated .result p { color: var(--foreground-color); - font-size: 1.2rem; + font-size: 1.4rem; + line-height: 2.4rem; margin-top: 0.3rem; word-wrap: break-word; line-break: anywhere; @@ -395,10 +449,13 @@ footer { font-size: 1.2rem; padding: 1rem; color: var(--color-five); + display: flex; + gap: 1rem; + justify-content: right; } ``` -### Styles for the 404 page +#### Styles for the 404 page ```css .error_container { @@ -448,11 +505,11 @@ footer { } ``` -### Styles for the previous and next button on the search page +#### Styles for the previous and next button on the search page ```css .page_navigation { - padding: 0 0 2rem 0; + padding: 0 0 2rem; display: flex; justify-content: space-between; align-items: center; @@ -472,7 +529,7 @@ footer { } ``` -### Styles for the about page +#### Styles for the about page This part is only available right now in the **rolling/edge/unstable** version @@ -517,7 +574,7 @@ This part is only available right now in the **rolling/edge/unstable** version } ``` -### Styles for the Settings Page +#### Styles for the Settings Page This part is only available right now in the **rolling/edge/unstable** version @@ -526,6 +583,7 @@ This part is only available right now in the **rolling/edge/unstable** version display: flex; justify-content: space-around; width: 80dvw; + margin: 5rem 0; } .settings h1 { @@ -533,9 +591,18 @@ This part is only available right now in the **rolling/edge/unstable** version font-size: 2.5rem; } +.settings > h1 { + margin-bottom: 4rem; + margin-left: 2rem; +} + .settings hr { border-color: var(--color-three); - margin: 0.3rem 0 1rem 0; + margin: 0.3rem 0 1rem; +} + +.settings > hr { + margin-left: 2rem; } .settings_container .sidebar { @@ -548,7 +615,6 @@ This part is only available right now in the **rolling/edge/unstable** version margin-left: -0.7rem; padding: 0.7rem; border-radius: 5px; - font-weight: bold; margin-bottom: 0.5rem; color: var(--foreground-color); text-transform: capitalize; @@ -556,18 +622,30 @@ This part is only available right now in the **rolling/edge/unstable** version } .settings_container .sidebar .btn { - padding: 0.5rem; + padding: 2rem; border-radius: 0.5rem; + outline-offset: 3px; + outline: 2px solid transparent; +} + +.settings_container .sidebar .btn:active { + outline: 2px solid var(--color-two); +} + +.settings_container .sidebar .btn:not(.active):hover { + color: var(--color-two); } .settings_container .sidebar .btn.active { background-color: var(--color-two); + color: var(--background-color); } .settings_container .main_container { width: 70%; border-left: 1.5px solid var(--color-three); padding-left: 3rem; + border: none; } .settings_container .tab { @@ -576,6 +654,7 @@ This part is only available right now in the **rolling/edge/unstable** version .settings_container .tab.active { display: flex; + gap: 1.2rem; flex-direction: column; justify-content: space-around; } @@ -623,7 +702,7 @@ This part is only available right now in the **rolling/edge/unstable** version .settings_container .general select { margin: 0.7rem 0; width: 20rem; - background-color: var(--background-color); + background-color: var(--color-one); color: var(--foreground-color); padding: 1rem 2rem; border-radius: 0.5rem; @@ -641,16 +720,19 @@ This part is only available right now in the **rolling/edge/unstable** version display: flex; flex-direction: column; justify-content: center; - gap: 1rem; padding: 1rem 0; + margin-bottom: 2rem; + gap: 2rem; } .settings_container .engines .toggle_btn { color: var(--foreground-color); font-size: 1.5rem; display: flex; - gap: 0.5rem; align-items: center; + border-radius: 100px; + gap: 1.5rem; + letter-spacing: 1px; } .settings_container .engines hr { @@ -658,11 +740,11 @@ This part is only available right now in the **rolling/edge/unstable** version } .settings_container .cookies input { - margin: 1rem 0rem; + margin: 1rem 0; } ``` -### Styles for the Toggle Button +#### Styles for the Toggle Button This part is only available right now in the **rolling/edge/unstable** version @@ -686,25 +768,26 @@ This part is only available right now in the **rolling/edge/unstable** version .slider { position: absolute; cursor: pointer; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: var(--background-color); - -webkit-transition: 0.4s; - transition: 0.4s; + inset: 0; + background-color: var(--foreground-color); + transition: 0.2s; + outline-offset: 3px; + outline: 2px solid transparent; } -.slider:before { +.slider:active { + outline: 2px solid var(--foreground-color); +} + +.slider::before { position: absolute; content: ''; height: 2.6rem; width: 2.6rem; left: 0.4rem; bottom: 0.4rem; - background-color: var(--foreground-color); - -webkit-transition: 0.4s; - transition: 0.4s; + background-color: var(--background-color); + transition: 0.2s; } input:checked + .slider { @@ -715,9 +798,7 @@ input:focus + .slider { box-shadow: 0 0 1px var(--color-three); } -input:checked + .slider:before { - -webkit-transform: translateX(2.6rem); - -ms-transform: translateX(2.6rem); +input:checked + .slider::before { transform: translateX(2.6rem); } @@ -726,9 +807,79 @@ input:checked + .slider:before { border-radius: 3.4rem; } -.slider.round:before { +.slider.round::before { border-radius: 50%; } ``` +## Animations + +### Built-in + +By default `websurfx` comes with 1 animation to choose from which can be easily chosen using the config file or via the settings page on the website. + +> To how to change animations using the config file. See: [**Configuration**](https://github.com/neon-mmd/websurfx/wiki/configuration) + +### Custom + +To write custom animation, it requires the user to have some knowledge of `themes` and the `HTML of the page for which the animation is being provided for`. + +The animations can be of 2 categories: + +- Theme specific animations +- Universal animations + +#### Theme Specific Animations + +These animations can only be used with a specific theme and should not be used with other themes otherwise it either won't look good or won't work at all or would work partially. + +Here is an example of `simple-frosted-glow` animation for the `simple theme` (which we provide by default with the app) which will give you a better idea on how to create a custom animation for a specific theme: + +```css +.results_aggregated .result { + margin: 1rem; + padding: 1rem; + border-radius: 1rem; +} + +.results_aggregated .result:hover { + box-shadow: + inset 0 0 3rem var(--color-two), + inset 0 0 6rem var(--color-five), + inset 0 0 9rem var(--color-three), + 0 0 0.25rem var(--color-two), + 0 0 0.5rem var(--color-five), + 0 0 0.75rem var(--color-three); +} +``` + +#### Universal Animations + +These animations are independent of the theme being used and can be used with all the themes. + +Here is an example of `text-tilt` animation which will give you an idea on how to create universal animations for the search engine website. + +```css +.results_aggregated .result:hover { + transform: skewX(10deg); +} +``` + +> [!Note] +> 1. The above-mentioned examples of animations was covered for the search page of the search engine website. While the same way of creating custom animations can also be done for other pages also. +> 2. While the naming the file for the new theme file. Follow the following naming conventions: +> 1. If the animation is theme specfic then name of the animation file should look like this: +> `` +> **For example:** +> If the animation to make search results frosty glow on hover was to be created for the `simple` theme then the name of the file would look something like this: +> `simple-frosted-glow` +> Where `simple` is the name of the theme the animation targets and `frosted-glow` is the name of the animation where each word has been seperated by a hyphen. +> 2. If the animation is not theme specfic (univeral theme) then name of the animation file should look like this: +> `` +> **For example:** +> If the animation to make search results text tilt on hover was to be created then the name of the file would look something like this: +> `text-tilt` +> Where `text-tilt` is the name of the animation where each word has been seperated by a hyphen. (While naming the files for these types of themes, You do not need to add a theme name in frontend of the file name.). + + [⬅️ Go back to Home](./README.md) From e8f9ad247910a81c96b2e108eb5c4628e147f526 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 23 Dec 2023 20:05:33 +0300 Subject: [PATCH 04/32] =?UTF-8?q?=F0=9F=93=9D=20docs:=20provide=20a=20note?= =?UTF-8?q?=20on=20the=20`pkg=5Fenv`=20environment=20variable=20&=20update?= =?UTF-8?q?=20the=20example=20config=20file=20(#439)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/installation.md | 53 +++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index c7e4619..6e7bcbe 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -44,7 +44,7 @@ nix build .#websurfx nix run .#websurfx ``` -> **Note** +> [!Note] > In the above command the dollar sign(**$**) refers to running the command in Privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods. Once you have run the above set of commands, open your preferred web browser and navigate to http://127.0.0.1:8080/ to start using Websurfx. @@ -89,7 +89,7 @@ nix build .#websurfx nix run .#websurfx ``` -> **Note** +> [!Note] > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods. ## Other Distros @@ -128,6 +128,16 @@ cd websurfx Once you have changed the directory to the `websurfx` directory then follow the build options listed below: +> [!Note] +> Before you start building the search engine using one of the below listed command. We would strongly recommend setting the `PKG_ENV` enviroment variable as this applies some special optimization to code to reduce the file and improve the page load speed of the website. +> To set the `PKG_ENV` enviroment variable in the `bash` shell run the following command: +> +> ```bash +> export PKG_ENV="prod" +> ``` +> +> For how to set the environment variables in other shells. You can follow the instructions on how to do so by visiting the documentation of the specific shell you are using. + ### Hybrid Cache > For more information on the features and their pros and cons. see: [**Features**](./features.md) @@ -285,22 +295,22 @@ Then run the following command to deploy the search engine: $ docker compose up -d ``` -> **Note** +> [!Note] > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec` or any other privileged access methods. Then launch the browser of your choice and navigate to http://:. -> **Note** +> [!Note] > The official prebuild images only support `stable` versions of the app and will not support `rolling/edge/unstable` versions. But with support and contribution, it could be made available for these versions as well 🙂. ## Manual Deployment This section covers how to deploy the app with docker manually by manually building the image and deploying it. -> **Note** +> [!Note] > This section is provided for those who want to further customize the docker image or for those who are extra cautious about security. -> **Warning** +> [!Warning] > A note of caution the project currently only supports **x86-64** architecture and as such we do not recommend deploying the project on devices with other architectures. Though if you still want to do it then **do it at your own risk**. ### Unstable/Edge/Rolling @@ -317,19 +327,19 @@ After that edit the config.lua file located under `websurfx` directory. In the c ```lua -- ### General ### logging = true -- an option to enable or disable logs. -debug = false -- an option to enable or disable debug mode. -threads = 8 -- the amount of threads that the app will use to run (the value should be greater than 0). +debug = false -- an option to enable or disable debug mode. +threads = 10 -- the amount of threads that the app will use to run (the value should be greater than 0). -- ### Server ### -port = "8080" -- port on which server should be launched -binding_ip = "0.0.0.0" --ip address on the server should be launched. -production_use = false -- whether to use production mode or not (in other words this option should be used if it is to be used to host it on the server to provide a service to a large number of users (more than one)) +port = "8080" -- port on which server should be launched +binding_ip = "127.0.0.1" --ip address on the which server should be launched. +production_use = false -- whether to use production mode or not (in other words this option should be used if it is to be used to host it on the server to provide a service to a large number of users (more than one)) -- if production_use is set to true -- There will be a random delay before sending the request to the search engines, this is to prevent DDoSing the upstream search engines from a large number of simultaneous requests. -request_timeout = 30 -- timeout for the search requests sent to the upstream search engines to be fetched (value in seconds). +request_timeout = 30 -- timeout for the search requests sent to the upstream search engines to be fetched (value in seconds). rate_limiter = { - number_of_requests = 20, -- The number of requests that are allowed within a provided time limit. - time_limit = 3, -- The time limit in which the number of requests that should be accepted. + number_of_requests = 20, -- The number of request that are allowed within a provided time limit. + time_limit = 3, -- The time limit in which the quantity of requests that should be accepted. } -- ### Search ### @@ -360,15 +370,18 @@ safe_search = 2 -- tomorrow-night -- }} colorscheme = "catppuccin-mocha" -- the colorscheme name which should be used for the website theme -theme = "simple" -- the theme name which should be used for the website +theme = "simple" -- the theme name which should be used for the website -- ### Caching ### -redis_url = "redis://redis:6379" -- redis connection url address on which the client should connect on. - +redis_url = "redis://127.0.0.1:8082" -- redis connection url address on which the client should connect on. +cache_expiry_time = 600 -- This option takes the expiry time of the search results (value in seconds and the value should be greater than or equal to 60 seconds). -- ### Search Engines ### upstream_search_engines = { - DuckDuckGo = true, - Searx = false, + DuckDuckGo = true, + Searx = false, + Brave = false, + Startpage = false, + LibreX = false, } -- select the upstream search engines from which the results should be fetched. ``` @@ -378,7 +391,7 @@ After this make sure to edit the `docker-compose.yml` and `Dockerfile` files as $ docker compose up -d --build ``` -> **Note** +> [!Note] > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods. This will take around 5-10 mins for the first deployment, afterwards, the docker build stages will be cached so it will be faster to build from next time onwards. After the above step finishes launch your preferred browser and then navigate to `http://:`. From 96ed04c29811153f63af0df3907e288426e04770 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 23 Dec 2023 20:23:41 +0300 Subject: [PATCH 05/32] =?UTF-8?q?=F0=9F=94=96=20chore:=20bump=20the=20app?= =?UTF-8?q?=20version=20(#439)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 312 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 152 insertions(+), 162 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2fd6ab9..8c3b1cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,16 +14,16 @@ dependencies = [ "futures-sink", "memchr", "pin-project-lite", - "tokio 1.34.0", + "tokio 1.35.1", "tokio-util", "tracing", ] [[package]] name = "actix-cors" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b340e9cfa5b08690aae90fb61beb44e9b06f44fe3d0f93781aaa58cfba86245e" +checksum = "0346d8c1f762b41b458ed3145eea914966bb9ad20b9be0d6d463b20d45586370" dependencies = [ "actix-utils", "actix-web", @@ -90,7 +90,7 @@ dependencies = [ "http 0.2.11", "httparse", "httpdate", - "itoa 1.0.9", + "itoa 1.0.10", "language-tags", "local-channel", "mime", @@ -99,7 +99,7 @@ dependencies = [ "rand 0.8.5", "sha1", "smallvec 1.11.2", - "tokio 1.34.0", + "tokio 1.35.1", "tokio-util", "tracing", ] @@ -111,7 +111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -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.35.1", ] [[package]] @@ -148,9 +148,9 @@ dependencies = [ "actix-utils", "futures-core", "futures-util", - "mio 0.8.9", - "socket2 0.5.5", - "tokio 1.34.0", + "mio 0.8.10", + "socket2", + "tokio 1.35.1", "tracing", ] @@ -199,7 +199,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "itoa 1.0.9", + "itoa 1.0.10", "language-tags", "log", "mime", @@ -210,8 +210,8 @@ dependencies = [ "serde_json", "serde_urlencoded 0.7.1", "smallvec 1.11.2", - "socket2 0.5.5", - "time 0.3.30", + "socket2", + "time 0.3.31", "url 2.5.0", ] @@ -222,9 +222,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb1f50ebbb30eca122b188319a4398b3f7bb4a8cdf50ecfb73bfc6a3c3ce54f5" dependencies = [ "actix-router", - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -313,9 +313,9 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" [[package]] name = "arc-swap" @@ -352,7 +352,7 @@ dependencies = [ "futures-core", "memchr", "pin-project-lite", - "tokio 1.34.0", + "tokio 1.35.1", ] [[package]] @@ -363,13 +363,13 @@ checksum = "9338790e78aa95a416786ec8389546c4b6a1dfc3dc36071ed9518a9413a542eb" [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -637,18 +637,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.10" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.9" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" dependencies = [ "anstyle", "clap_lex", @@ -679,7 +679,7 @@ dependencies = [ "futures-core", "memchr", "pin-project-lite", - "tokio 1.34.0", + "tokio 1.35.1", "tokio-util", ] @@ -698,7 +698,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e1e0fdd2e5d3041e530e1b21158aeeef8b5d0e306bc5c1e3d6cf0930d10e25a" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "syn 1.0.109", ] @@ -732,7 +732,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding 2.3.1", - "time 0.3.30", + "time 0.3.31", "version_check", ] @@ -824,12 +824,12 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.16", + "crossbeam-utils 0.8.17", ] [[package]] @@ -882,9 +882,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" dependencies = [ "cfg-if 1.0.0", ] @@ -907,7 +907,7 @@ checksum = "5b3df4f93e5fbbe73ec01ec8d3f68bba73107993a5b1e7519273c32db9b0d5be" dependencies = [ "cssparser-macros", "dtoa-short", - "itoa 1.0.9", + "itoa 1.0.10", "phf 0.11.2", "smallvec 1.11.2", ] @@ -920,7 +920,7 @@ checksum = "9be934d936a0fbed5bcdc01042b770de1398bf79d0e192f49fa7faea0e99281e" dependencies = [ "cssparser-macros", "dtoa-short", - "itoa 1.0.9", + "itoa 1.0.10", "phf 0.11.2", "smallvec 1.11.2", ] @@ -941,7 +941,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -965,9 +965,9 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ "powerfmt", ] @@ -979,7 +979,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "rustc_version 0.4.0", "syn 1.0.109", @@ -1123,7 +1123,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "syn 1.0.109", "synstructure", @@ -1294,9 +1294,9 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -1436,7 +1436,7 @@ dependencies = [ "http 0.2.11", "indexmap 2.1.0", "slab", - "tokio 1.34.0", + "tokio 1.35.1", "tokio-util", "tracing", ] @@ -1477,11 +1477,11 @@ checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1507,7 +1507,7 @@ dependencies = [ "log", "mac", "markup5ever 0.11.0", - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "syn 1.0.109", ] @@ -1531,7 +1531,7 @@ checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes 1.5.0", "fnv", - "itoa 1.0.9", + "itoa 1.0.10", ] [[package]] @@ -1548,9 +1548,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes 1.5.0", "http 0.2.11", @@ -1607,9 +1607,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes 1.5.0", "futures-channel", @@ -1617,13 +1617,13 @@ dependencies = [ "futures-util", "h2 0.3.22", "http 0.2.11", - "http-body 0.4.5", + "http-body 0.4.6", "httparse", "httpdate", - "itoa 1.0.9", + "itoa 1.0.10", "pin-project-lite", - "socket2 0.4.10", - "tokio 1.34.0", + "socket2", + "tokio 1.35.1", "tower-service", "tracing", "want 0.3.1", @@ -1637,9 +1637,9 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.11", - "hyper 0.14.27", + "hyper 0.14.28", "rustls", - "tokio 1.34.0", + "tokio 1.35.1", "tokio-rustls", ] @@ -1751,9 +1751,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" @@ -1788,9 +1788,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libmimalloc-sys" @@ -1872,18 +1872,18 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lua-src" -version = "546.0.1" +version = "546.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c26d4af78361e025a3d03a2b964cd1592aff7495f4d4f7947218c084c6fdca8" +checksum = "2da0daa7eee611a4c30c8f5ee31af55266e26e573971ba9336d2993e2da129b2" dependencies = [ "cc", ] [[package]] name = "luajit-src" -version = "210.5.2+113a168" +version = "210.5.3+29b0b28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "823ec7bedb1819b11633bd583ae981b0082db08492b0c3396412b85dd329ffee" +checksum = "0c2bb89013916ce5c949f01a1fbd6d435a58e1d980767a791d755911211d792d" dependencies = [ "cc", "which", @@ -1897,9 +1897,9 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] name = "mach2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" dependencies = [ "libc", ] @@ -1949,7 +1949,7 @@ checksum = "b0bab19cef8a7fe1c18a43e881793bfc9d4ea984befec3ae5bd0415abf3ecf00" dependencies = [ "actix-web", "futures-util", - "itoa 1.0.9", + "itoa 1.0.10", "maud_macros", ] @@ -1960,7 +1960,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0be95d66c3024ffce639216058e5bae17a83ecaf266ffc6e4d060ad447c9eed2" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "syn 1.0.109", ] @@ -2018,7 +2018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23e0b72e7c9042467008b10279fc732326bd605459ae03bda88825909dd19b56" dependencies = [ "crossbeam-channel", - "crossbeam-utils 0.8.16", + "crossbeam-utils 0.8.17", "dashmap", "skeptic", "smallvec 1.11.2", @@ -2076,9 +2076,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "log", @@ -2207,9 +2207,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oorandom" @@ -2219,9 +2219,9 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "openssl" -version = "0.10.60" +version = "0.10.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -2238,9 +2238,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -2251,9 +2251,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.96" +version = "0.9.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" dependencies = [ "cc", "libc", @@ -2449,9 +2449,9 @@ checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ "phf_generator 0.11.2", "phf_shared 0.11.2", - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -2496,9 +2496,9 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -2515,9 +2515,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" [[package]] name = "powerfmt" @@ -2544,7 +2544,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "syn 1.0.109", "version_check", @@ -2556,7 +2556,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "version_check", ] @@ -2572,9 +2572,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] @@ -2606,7 +2606,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" dependencies = [ - "crossbeam-utils 0.8.16", + "crossbeam-utils 0.8.17", "libc", "mach2", "once_cell", @@ -2631,7 +2631,7 @@ version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", ] [[package]] @@ -2800,11 +2800,11 @@ dependencies = [ "combine", "futures 0.3.29", "futures-util", - "itoa 1.0.9", + "itoa 1.0.10", "percent-encoding 2.3.1", "pin-project-lite", "ryu", - "tokio 1.34.0", + "tokio 1.35.1", "tokio-retry", "tokio-util", "url 2.5.0", @@ -2890,9 +2890,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ "async-compression", "base64 0.21.5", @@ -2902,8 +2902,8 @@ dependencies = [ "futures-util", "h2 0.3.22", "http 0.2.11", - "http-body 0.4.5", - "hyper 0.14.27", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-rustls", "ipnet", "js-sys", @@ -2918,7 +2918,7 @@ dependencies = [ "serde_json", "serde_urlencoded 0.7.1", "system-configuration", - "tokio 1.34.0", + "tokio 1.35.1", "tokio-rustls", "tokio-util", "tower-service", @@ -2932,9 +2932,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.6" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684d5e6e18f669ccebf64a92236bb7db9a34f07be010e3627368182027180866" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", "getrandom", @@ -2976,9 +2976,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.26" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ "bitflags 2.4.1", "errno", @@ -2989,9 +2989,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.9" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring", @@ -3032,9 +3032,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "same-file" @@ -3176,9 +3176,9 @@ version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -3187,7 +3187,7 @@ version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ - "itoa 1.0.9", + "itoa 1.0.10", "ryu", "serde", ] @@ -3211,7 +3211,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.9", + "itoa 1.0.10", "ryu", "serde", ] @@ -3299,16 +3299,6 @@ dependencies = [ "serde", ] -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "socket2" version = "0.5.5" @@ -3377,7 +3367,7 @@ checksum = "f0f45ed1b65bf9a4bf2f7b7dc59212d1926e9eaf00fa998988e420fd124467c6" dependencies = [ "phf_generator 0.7.24", "phf_shared 0.7.24", - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "string_cache_shared", ] @@ -3390,7 +3380,7 @@ checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ "phf_generator 0.10.0", "phf_shared 0.10.0", - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", ] @@ -3417,18 +3407,18 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.39" +version = "2.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "unicode-ident", ] @@ -3439,7 +3429,7 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", "syn 1.0.109", "unicode-xid 0.2.4", @@ -3525,12 +3515,12 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", - "itoa 1.0.9", + "itoa 1.0.10", "powerfmt", "serde", "time-core", @@ -3545,9 +3535,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -3598,19 +3588,19 @@ dependencies = [ [[package]] name = "tokio" -version = "1.34.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes 1.5.0", "libc", - "mio 0.8.9", + "mio 0.8.10", "num_cpus", "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2", "tokio-macros", "windows-sys 0.48.0", ] @@ -3663,9 +3653,9 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -3695,7 +3685,7 @@ checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" dependencies = [ "pin-project", "rand 0.8.5", - "tokio 1.34.0", + "tokio 1.35.1", ] [[package]] @@ -3705,7 +3695,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", - "tokio 1.34.0", + "tokio 1.35.1", ] [[package]] @@ -3771,7 +3761,7 @@ dependencies = [ "futures-core", "futures-sink", "pin-project-lite", - "tokio 1.34.0", + "tokio 1.35.1", "tracing", ] @@ -3818,9 +3808,9 @@ checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "try_from" @@ -3848,9 +3838,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-ident" @@ -4001,9 +3991,9 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", "wasm-bindgen-shared", ] @@ -4035,9 +4025,9 @@ version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4066,7 +4056,7 @@ checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "websurfx" -version = "1.5.3" +version = "1.6.8" dependencies = [ "actix-cors", "actix-files", @@ -4090,14 +4080,14 @@ dependencies = [ "mlua", "redis", "regex", - "reqwest 0.11.22", + "reqwest 0.11.23", "rusty-hook", "scraper", "serde", "serde_json", "smallvec 1.11.2", "tempfile", - "tokio 1.34.0", + "tokio 1.35.1", ] [[package]] @@ -4319,20 +4309,20 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.28" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.28" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ - "proc-macro2 1.0.70", + "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.39", + "syn 2.0.42", ] diff --git a/Cargo.toml b/Cargo.toml index 20aec8a..00be915 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.5.3" +version = "1.6.8" 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 43357493d550ffe321fffbd668a7b7a7afe6c7a9 Mon Sep 17 00:00:00 2001 From: maokwen Date: Wed, 27 Dec 2023 16:24:44 +0800 Subject: [PATCH 06/32] =?UTF-8?q?=F0=9F=90=9B=20fix:=20explicit=20Content-?= =?UTF-8?q?Type=20header=20for=20HTTP=20response=20(#457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/router.rs | 62 ++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/src/server/router.rs b/src/server/router.rs index b9fe1d4..0fb37d1 100644 --- a/src/server/router.rs +++ b/src/server/router.rs @@ -12,14 +12,16 @@ 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(config: web::Data) -> Result> { - Ok(HttpResponse::Ok().body( - crate::templates::views::index::index( - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - ) - .0, - )) + Ok(HttpResponse::Ok() + .content_type("text/html; charset=utf-8") + .body( + crate::templates::views::index::index( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + ) + .0, + )) } /// Handles the route of any other accessed route/page which is not provided by the @@ -52,14 +54,16 @@ pub async fn robots_data(_req: HttpRequest) -> Result) -> Result> { - Ok(HttpResponse::Ok().body( - crate::templates::views::about::about( - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - ) - .0, - )) + Ok(HttpResponse::Ok() + .content_type("text/html; charset=utf-8") + .body( + crate::templates::views::about::about( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + ) + .0, + )) } /// Handles the route of settings page of the `websurfx` meta search engine website. @@ -67,16 +71,18 @@ pub async fn about(config: web::Data) -> Result, ) -> Result> { - Ok(HttpResponse::Ok().body( - crate::templates::views::settings::settings( - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - &config - .upstream_search_engines - .keys() - .collect::>(), - )? - .0, - )) + Ok(HttpResponse::Ok() + .content_type("text/html; charset=utf-8") + .body( + crate::templates::views::settings::settings( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + &config + .upstream_search_engines + .keys() + .collect::>(), + )? + .0, + )) } From 9f5213cf42165dd36133a2e6bcdf0e77b81edfb2 Mon Sep 17 00:00:00 2001 From: maokwen Date: Thu, 28 Dec 2023 12:05:21 +0800 Subject: [PATCH 07/32] =?UTF-8?q?=F0=9F=90=9B=20fix:=20explicit=20`content?= =?UTF-8?q?-type`=20header=20for=20the=20search=20page=20response=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/routes/search.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/server/routes/search.rs b/src/server/routes/search.rs index 84ba3de..bfd7e76 100644 --- a/src/server/routes/search.rs +++ b/src/server/routes/search.rs @@ -68,16 +68,18 @@ pub async fn search( get_results(page + 1) ); - Ok(HttpResponse::Ok().body( - crate::templates::views::search::search( - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - query, - &results?, - ) - .0, - )) + Ok(HttpResponse::Ok() + .content_type("text/html; charset=utf-8") + .body( + crate::templates::views::search::search( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + query, + &results?, + ) + .0, + )) } None => Ok(HttpResponse::TemporaryRedirect() .insert_header(("location", "/")) From 34468202f949de4df273012b88dbe4f0d3fcdc5e Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 28 Dec 2023 19:54:28 +0300 Subject: [PATCH 08/32] =?UTF-8?q?=F0=9F=9A=B8=20chore:=20add=20code=20to?= =?UTF-8?q?=20display=20saved=20user=20settings=20from=20the=20cookies=20o?= =?UTF-8?q?n=20the=20settings=20page=20(#461)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/cookies.js | 70 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/public/static/cookies.js b/public/static/cookies.js index 6b55e02..3525c5b 100644 --- a/public/static/cookies.js +++ b/public/static/cookies.js @@ -1,3 +1,62 @@ +/** + * This functions gets the saved cookies if it is present on the user's machine If it + * is available then it is parsed and converted to an object which is then used to + * retrieve the preferences that the user had selected previously and is then loaded + * and used for displaying the user provided settings by setting them as the selected + * options in the settings page. + * + * @function + * @param {string} cookie - It takes the client settings cookie as a string. + * @returns {void} + */ +function setClientSettingsOnPage(cookie) { + let cookie_value = cookie + .split(';') + .map((item) => item.split('=')) + .reduce((acc, [_, v]) => (acc = JSON.parse(v)) && acc, {}) + + // Loop through all select tags and add their values to the cookie dictionary + document.querySelectorAll('select').forEach((select_tag) => { + switch (select_tag.name) { + case 'themes': + select_tag.value = cookie_value['theme'] + break + case 'colorschemes': + select_tag.value = cookie_value['colorscheme'] + break + case 'animations': + select_tag.value = cookie_value['animation'] + break + case 'safe_search_levels': + select_tag.value = cookie_value['safe_search_level'] + break + } + }) + let engines = document.querySelectorAll('.engine') + let engines_cookie = cookie_value['engines'] + + if (engines_cookie.length === engines.length) { + document.querySelector('.select_all').checked = true + engines.forEach((engine_checkbox) => { + engine_checkbox.checked = true + }) + } else { + engines.forEach((engines_checkbox) => { + engines_checkbox.checked = false + }) + engines_cookie.forEach((engine_name) => { + engines.forEach((engine_checkbox) => { + if ( + engine_checkbox.parentNode.parentNode.innerText.trim() === + engine_name.trim() + ) { + engine_checkbox.checked = true + } + }) + }) + } +} + /** * This function is executed when any page on the website finishes loading and * this function retrieves the cookies if it is present on the user's machine. @@ -16,9 +75,14 @@ document.addEventListener( let cookie = decodeURIComponent(document.cookie) // Set the value of the input field to the decoded cookie value if it is not empty // Otherwise, display a message indicating that no cookies have been saved on the user's system - document.querySelector('.cookies input').value = cookie.length - ? cookie - : 'No cookies have been saved on your system' + if (cookie.length) { + document.querySelector('.cookies input').value = cookie + // This function displays the user provided settings on the settings page. + setClientSettingsOnPage(cookie) + } else { + document.querySelector('.cookies input').value = + 'No cookies have been saved on your system' + } } catch (error) { // If there is an error decoding the cookie, log the error to the console // and display an error message in the input field From b7a23f1826eb0bee522008398292231c4188d8ab Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 28 Dec 2023 19:54:47 +0300 Subject: [PATCH 09/32] =?UTF-8?q?=F0=9F=9A=B8=20chore:=20add=20code=20to?= =?UTF-8?q?=20display=20saved=20settings=20from=20the=20config=20on=20the?= =?UTF-8?q?=20settings=20page=20(#461)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../partials/settings_tabs/engines.rs | 59 ++++++++++++++----- .../partials/settings_tabs/general.rs | 22 +++++-- .../partials/settings_tabs/user_interface.rs | 38 ++++++++---- src/templates/views/settings.rs | 11 +++- 4 files changed, 99 insertions(+), 31 deletions(-) diff --git a/src/templates/partials/settings_tabs/engines.rs b/src/templates/partials/settings_tabs/engines.rs index 5394178..6bc4ee6 100644 --- a/src/templates/partials/settings_tabs/engines.rs +++ b/src/templates/partials/settings_tabs/engines.rs @@ -1,17 +1,20 @@ //! A module that handles the engines tab for setting page view in the `websurfx` frontend. +use std::collections::HashMap; + 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. +/// * `engine_names` - It takes the key value pair list of all available engine names and there corresponding +/// selected (enabled/disabled) value as an argument. /// /// # Returns /// /// It returns the compiled html markup code for the engines tab. -pub fn engines(engine_names: &[&String]) -> Markup { +pub fn engines(engine_names: &HashMap) -> Markup { html!( div class="engines tab"{ h1{"Engines"} @@ -20,21 +23,49 @@ pub fn engines(engine_names: &[&String]) -> Markup { "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" + // Checks whether all the engines are selected or not if they are then the + // checked `select_all` button is rendered otherwise the unchecked version + // is rendered. + @if engine_names.values().all(|selected| *selected == true){ + .toggle_btn{ + label class="switch"{ + input type="checkbox" class="select_all" onchange="toggleAllSelection()" checked; + span class="slider round"{} + } + "Select All" + } + } + @else{ + .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"{} + @for (engine_name, selected) in engine_names{ + // Checks whether the `engine_name` is selected or not if they are then the + // checked `engine` button is rendered otherwise the unchecked version is + // rendered. + @if *selected == true { + .toggle_btn{ + label class="switch"{ + input type="checkbox" class="engine" checked; + span class="slider round"{} + } + (format!("{}{}",engine_name[..1].to_uppercase().to_owned(), engine_name[1..].to_owned())) + } + } + @else { + .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())) } - (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 index 4b0043d..fbc196b 100644 --- a/src/templates/partials/settings_tabs/general.rs +++ b/src/templates/partials/settings_tabs/general.rs @@ -7,10 +7,14 @@ const SAFE_SEARCH_LEVELS: [(u8, &str); 3] = [(0, "None"), (1, "Low"), (2, "Moder /// A functions that handles the html code for the general tab for the settings page for the search page. /// +/// # Arguments +/// +/// * `safe_search_level` - It takes the safe search level as an argument. +/// /// # Returns /// /// It returns the compiled html markup code for the general tab. -pub fn general() -> Markup { +pub fn general(safe_search_level: u8) -> Markup { html!( div class="general tab active"{ h1{"General"} @@ -18,9 +22,19 @@ pub fn general() -> Markup { 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)} + @if safe_search_level < 3 { + select name="safe_search_levels" { + // Sets the user selected safe_search_level name from the config file as the first option in the selection list. + option value=(safe_search_level){(SAFE_SEARCH_LEVELS.iter().filter(|level| level.0 == safe_search_level).next().unwrap().1)} + @for (k,v) in SAFE_SEARCH_LEVELS.iter().filter(|level| level.0 != safe_search_level){ + option value=(k){(v)} + } + } + } + @else { + p class="admin_warning" {"⚠️ This setting is being managed by the server administrator."} + select name="safe_search_levels" disabled { + option value=(SAFE_SEARCH_LEVELS[2].0){(SAFE_SEARCH_LEVELS[2].1)} } } } diff --git a/src/templates/partials/settings_tabs/user_interface.rs b/src/templates/partials/settings_tabs/user_interface.rs index d94465b..cb6c20a 100644 --- a/src/templates/partials/settings_tabs/user_interface.rs +++ b/src/templates/partials/settings_tabs/user_interface.rs @@ -4,13 +4,16 @@ use crate::handler::{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. +/// A helper function that helps in building the list of all available colorscheme/theme/animation +/// names present in the colorschemes, animations and themes folder respectively by excluding the +/// ones that have already been selected via the config file. /// /// # Arguments /// /// * `style_type` - It takes the style type of the values `theme` and `colorscheme` as an /// argument. +/// * `selected_style` - It takes the currently selected style value provided via the config file +/// as an argument. /// /// # Error /// @@ -18,7 +21,8 @@ use std::fs::read_dir; /// returns a standard error message. fn style_option_list( style_type: &str, -) -> Result, Box> { + selected_style: &str, +) -> Result, Box> { let mut style_option_names: Vec<(String, String)> = Vec::new(); for file in read_dir(format!( "{}static/{}/", @@ -26,7 +30,13 @@ 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('-', " "))); + if selected_style != style_name { + style_option_names.push((style_name.clone(), style_name.replace('-', " "))); + } + } + + if style_type == "animations" { + style_option_names.push(("".to_owned(), "none".to_owned())) } Ok(style_option_names) @@ -38,7 +48,11 @@ fn style_option_list( /// /// 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> { +pub fn user_interface( + theme: &str, + colorscheme: &str, + animation: &Option, +) -> Result> { Ok(html!( div class="user_interface tab"{ h1{"User Interface"} @@ -47,7 +61,9 @@ pub fn user_interface() -> Result> { "Select the theme from the available themes to be used in user interface" } select name="themes"{ - @for (k,v) in style_option_list("themes")?{ + // Sets the user selected theme name from the config file as the first option in the selection list. + option value=(theme){(theme.replace('-', " "))} + @for (k,v) in style_option_list("themes", theme)?{ option value=(k){(v)} } } @@ -56,7 +72,9 @@ pub fn user_interface() -> Result> { "Select the color scheme for your theme to be used in user interface" } select name="colorschemes"{ - @for (k,v) in style_option_list("colorschemes")?{ + // Sets the user selected colorscheme name from the config file as the first option in the selection list. + option value=(colorscheme){(colorscheme.replace('-', " "))} + @for (k,v) in style_option_list("colorschemes", colorscheme)?{ option value=(k){(v)} } } @@ -65,12 +83,12 @@ pub fn user_interface() -> Result> { "Select the animation for your theme to be used in user interface" } select name="animations"{ - option value=""{"none"} - @for (k,v) in style_option_list("animations")?{ + // Sets the user selected animation name from the config file as the first option in the selection list. + option value=(animation.as_ref().unwrap_or(&"".to_owned())){(animation.as_ref().unwrap_or(&"".to_owned()).replace('-'," "))} + @for (k,v) in style_option_list("animations", &animation.as_ref().unwrap_or(&"".to_owned()))?{ option value=(k){(v)} } } - } )) } diff --git a/src/templates/views/settings.rs b/src/templates/views/settings.rs index 6da5202..4f0878a 100644 --- a/src/templates/views/settings.rs +++ b/src/templates/views/settings.rs @@ -1,5 +1,7 @@ //! A module that handles the view for the settings page in the `websurfx` frontend. +use std::collections::HashMap; + use maud::{html, Markup}; use crate::templates::partials::{ @@ -14,8 +16,10 @@ use crate::templates::partials::{ /// /// # Arguments /// +/// * `safe_search_level` - It takes the safe search level as an argument. /// * `colorscheme` - It takes the colorscheme name as an argument. /// * `theme` - It takes the theme name as an argument. +/// * `animation` - It takes the animation name as an argument. /// * `engine_names` - It takes a list of engine names as an argument. /// /// # Error @@ -23,10 +27,11 @@ use crate::templates::partials::{ /// This function returns a compiled html markup code on success otherwise returns a standard error /// message. pub fn settings( + safe_search_level: u8, colorscheme: &str, theme: &str, animation: &Option, - engine_names: &[&String], + engine_names: &HashMap, ) -> Result> { Ok(html!( (header(colorscheme, theme, animation)) @@ -41,8 +46,8 @@ pub fn settings( .btn onclick="setActiveTab(this)"{"cookies"} } .main_container{ - (general()) - (user_interface()?) + (general(safe_search_level)) + (user_interface(theme, colorscheme, animation)?) (engines(engine_names)) (cookies()) p class="message"{} From 26aa345f06cebb1fa499cc60a9b09a90fdc712a3 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 28 Dec 2023 19:56:11 +0300 Subject: [PATCH 10/32] =?UTF-8?q?=F0=9F=9A=B8=20chore:=20pass=20the=20`saf?= =?UTF-8?q?e=5Fsearch=5Flevel`=20&=20`upstream=5Fsearch=5Fengines`=20as=20?= =?UTF-8?q?a=20hashmap=20in=20the=20`settings`=20view=20function=20(#461)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/router.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/server/router.rs b/src/server/router.rs index b9fe1d4..eb8d6af 100644 --- a/src/server/router.rs +++ b/src/server/router.rs @@ -69,13 +69,11 @@ pub async fn settings( ) -> Result> { Ok(HttpResponse::Ok().body( crate::templates::views::settings::settings( + config.safe_search, &config.style.colorscheme, &config.style.theme, &config.style.animation, - &config - .upstream_search_engines - .keys() - .collect::>(), + &config.upstream_search_engines, )? .0, )) From 7b392b369db96e169ba86aa447e64979bce49423 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 28 Dec 2023 20:09:35 +0300 Subject: [PATCH 11/32] =?UTF-8?q?=F0=9F=92=84=20chore:=20add=20style=20for?= =?UTF-8?q?=20the=20new=20message=20when=20a=20setting=20is=20managed=20by?= =?UTF-8?q?=20the=20config=20cannot=20be=20altered/modified=20(#461)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/themes/simple.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/static/themes/simple.css b/public/static/themes/simple.css index aab743e..ff05d70 100644 --- a/public/static/themes/simple.css +++ b/public/static/themes/simple.css @@ -600,12 +600,20 @@ footer div { text-transform: capitalize; } -.settings_container .tab .description { +.settings_container .tab .description, +.settings_container .tab .admin_warning { font-size: 1.5rem; margin-bottom: 0.5rem; +} + +.settings_container .tab .description { color: var(--foreground-color); } +.settings_container .tab .admin_warning { + color: var(--color-two); +} + .settings_container .user_interface select, .settings_container .general select { margin: 0.7rem 0; From 40138572bec2074218596700fbbbecaa7b42c2cf Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 28 Dec 2023 20:15:38 +0300 Subject: [PATCH 12/32] =?UTF-8?q?=F0=9F=9A=A8=20chore:=20make=20clippy=20c?= =?UTF-8?q?hecks=20happy=20(#461)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/templates/partials/settings_tabs/engines.rs | 4 ++-- src/templates/partials/settings_tabs/general.rs | 2 +- src/templates/partials/settings_tabs/user_interface.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/templates/partials/settings_tabs/engines.rs b/src/templates/partials/settings_tabs/engines.rs index 6bc4ee6..748cc07 100644 --- a/src/templates/partials/settings_tabs/engines.rs +++ b/src/templates/partials/settings_tabs/engines.rs @@ -26,7 +26,7 @@ pub fn engines(engine_names: &HashMap) -> Markup { // Checks whether all the engines are selected or not if they are then the // checked `select_all` button is rendered otherwise the unchecked version // is rendered. - @if engine_names.values().all(|selected| *selected == true){ + @if engine_names.values().all(|selected| *selected){ .toggle_btn{ label class="switch"{ input type="checkbox" class="select_all" onchange="toggleAllSelection()" checked; @@ -49,7 +49,7 @@ pub fn engines(engine_names: &HashMap) -> Markup { // Checks whether the `engine_name` is selected or not if they are then the // checked `engine` button is rendered otherwise the unchecked version is // rendered. - @if *selected == true { + @if *selected { .toggle_btn{ label class="switch"{ input type="checkbox" class="engine" checked; diff --git a/src/templates/partials/settings_tabs/general.rs b/src/templates/partials/settings_tabs/general.rs index fbc196b..7736667 100644 --- a/src/templates/partials/settings_tabs/general.rs +++ b/src/templates/partials/settings_tabs/general.rs @@ -25,7 +25,7 @@ pub fn general(safe_search_level: u8) -> Markup { @if safe_search_level < 3 { select name="safe_search_levels" { // Sets the user selected safe_search_level name from the config file as the first option in the selection list. - option value=(safe_search_level){(SAFE_SEARCH_LEVELS.iter().filter(|level| level.0 == safe_search_level).next().unwrap().1)} + option value=(safe_search_level){(SAFE_SEARCH_LEVELS.iter().find(|level| level.0 == safe_search_level).unwrap().1)} @for (k,v) in SAFE_SEARCH_LEVELS.iter().filter(|level| level.0 != safe_search_level){ option value=(k){(v)} } diff --git a/src/templates/partials/settings_tabs/user_interface.rs b/src/templates/partials/settings_tabs/user_interface.rs index cb6c20a..6916b26 100644 --- a/src/templates/partials/settings_tabs/user_interface.rs +++ b/src/templates/partials/settings_tabs/user_interface.rs @@ -85,7 +85,7 @@ pub fn user_interface( select name="animations"{ // Sets the user selected animation name from the config file as the first option in the selection list. option value=(animation.as_ref().unwrap_or(&"".to_owned())){(animation.as_ref().unwrap_or(&"".to_owned()).replace('-'," "))} - @for (k,v) in style_option_list("animations", &animation.as_ref().unwrap_or(&"".to_owned()))?{ + @for (k,v) in style_option_list("animations", animation.as_ref().unwrap_or(&"".to_owned()))?{ option value=(k){(v)} } } From 83c398169735ff1d2ce29e34b9d9979f384b0452 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 28 Dec 2023 20:22:05 +0300 Subject: [PATCH 13/32] =?UTF-8?q?=F0=9F=94=96=20chore:=20bump=20the=20app?= =?UTF-8?q?=20version=20(#461)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 132 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 67 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c3b1cd..f475e48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,15 +65,15 @@ checksum = "a2e7b88f3804e01bd4191fdb08650430bbfcb43d3d9b2890064df3551ec7d25b" dependencies = [ "actix-http", "actix-web", - "futures 0.3.29", + "futures 0.3.30", "governor", ] [[package]] name = "actix-http" -version = "3.4.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92ef85799cba03f76e4f7c10f533e66d87c9a7e7055f3391f09000ad8351bc9" +checksum = "129d4c88e98860e1758c5de288d1632b07970a16d59bdf7b8d66053d582bb71f" dependencies = [ "actix-codec", "actix-rt", @@ -111,14 +111,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] name = "actix-router" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" +checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" dependencies = [ "bytestring", "http 0.2.11", @@ -177,9 +177,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.4.0" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4a5b5e29603ca8c94a77c65cf874718ceb60292c5a5c3e5f4ace041af462b9" +checksum = "e43428f3bf11dee6d166b00ec2df4e3aa8cc1606aaa0b7433c146852e2f4e03b" dependencies = [ "actix-codec", "actix-http", @@ -224,7 +224,7 @@ dependencies = [ "actix-router", "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -313,9 +313,9 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anyhow" -version = "1.0.76" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" +checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" [[package]] name = "arc-swap" @@ -369,7 +369,7 @@ checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -552,9 +552,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" dependencies = [ "serde", ] @@ -824,12 +824,12 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" +checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.17", + "crossbeam-utils 0.8.18", ] [[package]] @@ -882,9 +882,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" +checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" dependencies = [ "cfg-if 1.0.0", ] @@ -941,7 +941,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -1232,9 +1232,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1247,9 +1247,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1257,9 +1257,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-cpupool" @@ -1273,9 +1273,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1284,32 +1284,32 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" @@ -1319,9 +1319,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1394,7 +1394,7 @@ checksum = "821239e5672ff23e2a7060901fa622950bbd80b649cdaadd78d1c1767ed14eb4" dependencies = [ "cfg-if 1.0.0", "dashmap", - "futures 0.3.29", + "futures 0.3.30", "futures-timer", "no-std-compat", "nonzero_ext", @@ -1725,13 +1725,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ "hermit-abi", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2018,7 +2018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23e0b72e7c9042467008b10279fc732326bd605459ae03bda88825909dd19b56" dependencies = [ "crossbeam-channel", - "crossbeam-utils 0.8.17", + "crossbeam-utils 0.8.18", "dashmap", "skeptic", "smallvec 1.11.2", @@ -2198,9 +2198,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -2240,7 +2240,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2451,7 +2451,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2498,7 +2498,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2606,7 +2606,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" dependencies = [ - "crossbeam-utils 0.8.17", + "crossbeam-utils 0.8.18", "libc", "mach2", "once_cell", @@ -2798,7 +2798,7 @@ dependencies = [ "async-trait", "bytes 1.5.0", "combine", - "futures 0.3.29", + "futures 0.3.30", "futures-util", "itoa 1.0.10", "percent-encoding 2.3.1", @@ -3047,11 +3047,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3178,7 +3178,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -3414,9 +3414,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.42" +version = "2.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" +checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", @@ -3474,15 +3474,15 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall 0.4.1", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3655,7 +3655,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -3993,7 +3993,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", "wasm-bindgen-shared", ] @@ -4027,7 +4027,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4056,7 +4056,7 @@ checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "websurfx" -version = "1.6.8" +version = "1.6.11" dependencies = [ "actix-cors", "actix-files", @@ -4070,7 +4070,7 @@ dependencies = [ "env_logger", "error-stack", "fake-useragent", - "futures 0.3.29", + "futures 0.3.30", "lightningcss", "log", "maud", @@ -4324,5 +4324,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] diff --git a/Cargo.toml b/Cargo.toml index 00be915..b3161ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.6.8" +version = "1.6.11" 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 d8943709c7eb19b7987440a22772397ddadeb726 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Thu, 28 Dec 2023 21:08:11 +0300 Subject: [PATCH 14/32] =?UTF-8?q?=F0=9F=9A=A8=20chore:=20make=20cargo=20fo?= =?UTF-8?q?rmat=20checks=20happy=20(#461)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/router.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/server/router.rs b/src/server/router.rs index a425cf4..74b8bfa 100644 --- a/src/server/router.rs +++ b/src/server/router.rs @@ -72,15 +72,15 @@ pub async fn settings( config: web::Data, ) -> Result> { Ok(HttpResponse::Ok() - .content_type("text/html; charset=utf-8") - .body( - crate::templates::views::settings::settings( - config.safe_search, - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - &config.upstream_search_engines, - )? - .0, - )) + .content_type("text/html; charset=utf-8") + .body( + crate::templates::views::settings::settings( + config.safe_search, + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + &config.upstream_search_engines, + )? + .0, + )) } From 9f23a1c70b5a387d81448aeb69ef91e31b0dae68 Mon Sep 17 00:00:00 2001 From: Jann Marc Villablanca <31008330+jfvillablanca@users.noreply.github.com> Date: Sat, 30 Dec 2023 00:21:06 +0800 Subject: [PATCH 15/32] =?UTF-8?q?=E2=9C=A8=20feat(engine):=20`mojeek`=20fo?= =?UTF-8?q?r=20the=20search=20engine=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🧑‍💻 fix: add closing curly brace in the nix build step * ✨ feat: add code to provide search results from `mojeek` engine --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- flake.nix | 2 +- src/engines/mod.rs | 1 + src/engines/mojeek.rs | 151 ++++++++++++++++++++++++++++++++++++ src/models/engine_models.rs | 4 + websurfx/config.lua | 1 + 5 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 src/engines/mojeek.rs diff --git a/flake.nix b/flake.nix index ba804f1..6c41514 100644 --- a/flake.nix +++ b/flake.nix @@ -60,4 +60,4 @@ # calls the build function packages.websurfx = packages.default; }); - +} diff --git a/src/engines/mod.rs b/src/engines/mod.rs index b6a50f5..d56ec6f 100644 --- a/src/engines/mod.rs +++ b/src/engines/mod.rs @@ -6,6 +6,7 @@ pub mod brave; pub mod duckduckgo; pub mod librex; +pub mod mojeek; pub mod search_result_parser; pub mod searx; pub mod startpage; diff --git a/src/engines/mojeek.rs b/src/engines/mojeek.rs new file mode 100644 index 0000000..3f7fbb1 --- /dev/null +++ b/src/engines/mojeek.rs @@ -0,0 +1,151 @@ +//! The `mojeek` module handles the scraping of results from the mojeek search engine +//! by querying the upstream mojeek search engine with user provided query and with a page +//! number if provided. + +use std::collections::HashMap; + +use reqwest::header::HeaderMap; +use reqwest::Client; +use scraper::Html; + +use crate::models::aggregation_models::SearchResult; + +use crate::models::engine_models::{EngineError, SearchEngine}; + +use error_stack::{Report, Result, ResultExt}; + +use super::search_result_parser::SearchResultParser; + +/// A new Mojeek engine type defined in-order to implement the `SearchEngine` trait which allows to +/// reduce code duplication as well as allows to create vector of different search engines easily. +pub struct Mojeek { + /// The parser, used to interpret the search result. + parser: SearchResultParser, +} + +impl Mojeek { + /// Creates the Mojeek parser. + pub fn new() -> Result { + Ok(Self { + parser: SearchResultParser::new( + ".result-col", + ".results-standard li", + "a span.url", + "h2 a.title", + "p.s", + )?, + }) + } +} + +#[async_trait::async_trait] +impl SearchEngine for Mojeek { + async fn results( + &self, + query: &str, + page: u32, + user_agent: &str, + client: &Client, + safe_search: u8, + ) -> Result, EngineError> { + // Mojeek uses `start results from this number` convention + // So, for 10 results per page, page 0 starts at 1, page 1 + // starts at 11, and so on. + let results_per_page = 10; + let start_result = results_per_page * page + 1; + + let results_per_page = results_per_page.to_string(); + let start_result = start_result.to_string(); + + let search_engines = vec![ + "Bing", + "Brave", + "DuckDuckGo", + "Ecosia", + "Google", + "Lilo", + "Metager", + "Qwant", + "Startpage", + "Swisscows", + "Yandex", + "Yep", + "You", + ]; + let qss = search_engines.join("%2C"); + let safe = if safe_search == 0 { "0" } else { "1" }; + + // Mojeek detects automated requests, these are preferences that are + // able to circumvent the countermeasure. Some of these are + // not documented in their Search API + let query_params: Vec<(&str, &str)> = vec![ + ("t", results_per_page.as_str()), + ("theme", "dark"), + ("arc", "none"), + ("date", "1"), + ("cdate", "1"), + ("tlen", "100"), + ("ref", "1"), + ("hp", "minimal"), + ("lb", "en"), + ("qss", &qss), + ("safe", safe), + ]; + + let mut query_params_string = String::new(); + for (k, v) in &query_params { + query_params_string.push_str(&format!("&{k}={v}")); + } + + let url: String = match page { + 0 => { + format!("https://www.mojeek.com/search?q={query}{query_params_string}") + } + _ => { + format!( + "https://www.mojeek.com/search?q={query}&s={start_result}{query_params_string}" + ) + } + }; + + let mut cookie_string = String::new(); + for (k, v) in &query_params { + cookie_string.push_str(&format!("{k}={v}; ")); + } + + let header_map = HeaderMap::try_from(&HashMap::from([ + ("USER_AGENT".to_string(), user_agent.to_string()), + ("REFERER".to_string(), "https://google.com/".to_string()), + ( + "CONTENT_TYPE".to_string(), + "application/x-www-form-urlencoded".to_string(), + ), + ("COOKIE".to_string(), cookie_string), + ])) + .change_context(EngineError::UnexpectedError)?; + + let document: Html = Html::parse_document( + &Mojeek::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) { + if no_result_msg + .inner_html() + .contains("No pages found matching:") + { + return Err(Report::new(EngineError::EmptyResultSet)); + } + } + + // scrape all the results from the html + self.parser + .parse_for_results(&document, |title, url, desc| { + Some(SearchResult::new( + title.inner_html().trim(), + url.inner_html().trim(), + desc.inner_html().trim(), + &["mojeek"], + )) + }) + } +} diff --git a/src/models/engine_models.rs b/src/models/engine_models.rs index 70496cd..2a698d5 100644 --- a/src/models/engine_models.rs +++ b/src/models/engine_models.rs @@ -162,6 +162,10 @@ impl EngineHandler { let engine = crate::engines::librex::LibreX::new()?; ("librex", Box::new(engine)) } + "mojeek" => { + let engine = crate::engines::mojeek::Mojeek::new()?; + ("mojeek", Box::new(engine)) + } _ => { return Err(Report::from(EngineError::NoSuchEngineFound( engine_name.to_string(), diff --git a/websurfx/config.lua b/websurfx/config.lua index 2444f86..ae7a6bb 100644 --- a/websurfx/config.lua +++ b/websurfx/config.lua @@ -64,4 +64,5 @@ upstream_search_engines = { Brave = false, Startpage = false, LibreX = false, + Mojeek = false, } -- select the upstream search engines from which the results should be fetched. From d073aa247ae391a60a4f7a2257be21bda8b80740 Mon Sep 17 00:00:00 2001 From: ddotthomas Date: Fri, 29 Dec 2023 11:20:38 -0700 Subject: [PATCH 16/32] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20start=20?= =?UTF-8?q?tracking=20page=20numbers=20from=200=20instead=20of=201=20in=20?= =?UTF-8?q?the=20backend=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: neon_arch --- src/server/routes/search.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/routes/search.rs b/src/server/routes/search.rs index bfd7e76..9261051 100644 --- a/src/server/routes/search.rs +++ b/src/server/routes/search.rs @@ -59,11 +59,11 @@ pub async fn search( ) }; - // .max(1) makes sure that the page > 0. - let page = params.page.unwrap_or(1).max(1); + // .max(1) makes sure that the page >= 0. + let page = params.page.unwrap_or(1).max(1) - 1; let (_, results, _) = join!( - get_results(page - 1), + get_results(page.saturating_sub(1)), get_results(page), get_results(page + 1) ); From 0dd25aacb6cfc0e9d2b8ee3bd9264ae4d949edef Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 30 Dec 2023 13:05:04 +0300 Subject: [PATCH 17/32] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20fix(engine):=20fi?= =?UTF-8?q?x=20the=20pagination=20code=20for=20`duckduckgo`=20engine=20(#4?= =?UTF-8?q?68)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/engines/duckduckgo.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/engines/duckduckgo.rs b/src/engines/duckduckgo.rs index d6316b8..c48522f 100644 --- a/src/engines/duckduckgo.rs +++ b/src/engines/duckduckgo.rs @@ -51,15 +51,14 @@ impl SearchEngine for DuckDuckGo { // Page number can be missing or empty string and so appropriate handling is required // so that upstream server recieves valid page number. let url: String = match page { - 1 | 0 => { + 0 => { format!("https://html.duckduckgo.com/html/?q={query}&s=&dc=&v=1&o=json&api=/d.js") } _ => { format!( - "https://duckduckgo.com/html/?q={}&s={}&dc={}&v=1&o=json&api=/d.js", - query, - (page / 2 + (page % 2)) * 30, - (page / 2 + (page % 2)) * 30 + 1 + "https://duckduckgo.com/html/?q={query}&s={}&dc={}&v=1&o=json&api=/d.js", + page * 30, + page * 30 + 1 ) } }; From 2bdddaf928e495cb965a30d8182ebe780313b916 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 30 Dec 2023 13:06:35 +0300 Subject: [PATCH 18/32] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20fix(engine):=20fi?= =?UTF-8?q?x=20the=20pagination=20code=20for=20`librex`=20engine=20(#468)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/engines/librex.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/engines/librex.rs b/src/engines/librex.rs index 933c7f2..b34393f 100644 --- a/src/engines/librex.rs +++ b/src/engines/librex.rs @@ -65,17 +65,10 @@ impl SearchEngine for LibreX { ) -> Result, EngineError> { // Page number can be missing or empty string and so appropriate handling is required // so that upstream server recieves valid page number. - let url: String = match page { - 1 | 0 => { - format!("https://search.ahwx.org/search.php?q={query}&p=0&t=10") - } - _ => { - format!( - "https://search.ahwx.org/search.php?q={query}&p={}&t=10", - page * 10, - ) - } - }; + let url: String = format!( + "https://search.ahwx.org/search.php?q={query}&p={}&t=10", + page * 10 + ); // initializing HeaderMap and adding appropriate headers. let header_map = HeaderMap::try_from(&HashMap::from([ From 72da32383e873b56c49e6bc697c329377f692c43 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 30 Dec 2023 13:06:57 +0300 Subject: [PATCH 19/32] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20fix(engine):=20fi?= =?UTF-8?q?x=20the=20pagination=20code=20for=20`searx`=20engine=20(#468)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/engines/searx.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/engines/searx.rs b/src/engines/searx.rs index 7f20b15..9bb297c 100644 --- a/src/engines/searx.rs +++ b/src/engines/searx.rs @@ -50,14 +50,10 @@ impl SearchEngine for Searx { safe_search = 2; }; - let url: String = match page { - 0 | 1 => { - format!("https://searx.be/search?q={query}&pageno=1&safesearch={safe_search}") - } - _ => { - format!("https://searx.be/search?q={query}&pageno={page}&safesearch={safe_search}") - } - }; + let url: String = format!( + "https://searx.be/search?q={query}&pageno={}&safesearch={safe_search}", + page + 1 + ); // initializing headers and adding appropriate headers. let header_map = HeaderMap::try_from(&HashMap::from([ From 7d42c84aaf71dbd3461b2b410513949effc1ea34 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 30 Dec 2023 13:07:18 +0300 Subject: [PATCH 20/32] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20fix(engine):=20fi?= =?UTF-8?q?x=20the=20pagination=20code=20for=20`startpage`=20engine=20(#46?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/engines/startpage.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/engines/startpage.rs b/src/engines/startpage.rs index 9a87721..540a0ce 100644 --- a/src/engines/startpage.rs +++ b/src/engines/startpage.rs @@ -50,17 +50,10 @@ impl SearchEngine for Startpage { ) -> Result, EngineError> { // Page number can be missing or empty string and so appropriate handling is required // so that upstream server recieves valid page number. - let url: String = match page { - 1 | 0 => { - format!("https://startpage.com/do/dsearch?q={query}&num=10&start=0") - } - _ => { - format!( - "https://startpage.com/do/dsearch?q={query}&num=10&start={}", - page * 10, - ) - } - }; + let url: String = format!( + "https://startpage.com/do/dsearch?q={query}&num=10&start={}", + page * 10, + ); // initializing HeaderMap and adding appropriate headers. let header_map = HeaderMap::try_from(&HashMap::from([ From f2907641d27813a1e98713c917e9fe3a72f8cd17 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 30 Dec 2023 13:08:55 +0300 Subject: [PATCH 21/32] =?UTF-8?q?=F0=9F=94=96=20chore(release):=20bump=20t?= =?UTF-8?q?he=20app=20version=20(#468)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 160 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c3b1cd..398eb1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,21 +65,21 @@ checksum = "a2e7b88f3804e01bd4191fdb08650430bbfcb43d3d9b2890064df3551ec7d25b" dependencies = [ "actix-http", "actix-web", - "futures 0.3.29", + "futures 0.3.30", "governor", ] [[package]] name = "actix-http" -version = "3.4.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92ef85799cba03f76e4f7c10f533e66d87c9a7e7055f3391f09000ad8351bc9" +checksum = "129d4c88e98860e1758c5de288d1632b07970a16d59bdf7b8d66053d582bb71f" dependencies = [ "actix-codec", "actix-rt", "actix-service", "actix-utils", - "ahash 0.8.6", + "ahash 0.8.7", "base64 0.21.5", "bitflags 2.4.1", "bytes 1.5.0", @@ -111,14 +111,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] name = "actix-router" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" +checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" dependencies = [ "bytestring", "http 0.2.11", @@ -177,9 +177,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.4.0" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4a5b5e29603ca8c94a77c65cf874718ceb60292c5a5c3e5f4ace041af462b9" +checksum = "e43428f3bf11dee6d166b00ec2df4e3aa8cc1606aaa0b7433c146852e2f4e03b" dependencies = [ "actix-codec", "actix-http", @@ -190,7 +190,7 @@ dependencies = [ "actix-service", "actix-utils", "actix-web-codegen", - "ahash 0.8.6", + "ahash 0.8.7", "bytes 1.5.0", "bytestring", "cfg-if 1.0.0", @@ -224,7 +224,7 @@ dependencies = [ "actix-router", "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -255,9 +255,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if 1.0.0", "getrandom", @@ -313,9 +313,9 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anyhow" -version = "1.0.76" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" +checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" [[package]] name = "arc-swap" @@ -369,7 +369,7 @@ checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -489,9 +489,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" dependencies = [ "memchr", "serde", @@ -552,9 +552,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" dependencies = [ "serde", ] @@ -637,18 +637,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" dependencies = [ "anstyle", "clap_lex", @@ -824,12 +824,12 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" +checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.17", + "crossbeam-utils 0.8.18", ] [[package]] @@ -882,9 +882,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" +checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" dependencies = [ "cfg-if 1.0.0", ] @@ -941,7 +941,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -1232,9 +1232,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1247,9 +1247,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1257,9 +1257,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-cpupool" @@ -1273,9 +1273,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1284,32 +1284,32 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" @@ -1319,9 +1319,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1394,7 +1394,7 @@ checksum = "821239e5672ff23e2a7060901fa622950bbd80b649cdaadd78d1c1767ed14eb4" dependencies = [ "cfg-if 1.0.0", "dashmap", - "futures 0.3.29", + "futures 0.3.30", "futures-timer", "no-std-compat", "nonzero_ext", @@ -1459,7 +1459,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.7", "bumpalo", ] @@ -1725,13 +1725,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ "hermit-abi", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1973,9 +1973,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memoffset" @@ -2018,7 +2018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23e0b72e7c9042467008b10279fc732326bd605459ae03bda88825909dd19b56" dependencies = [ "crossbeam-channel", - "crossbeam-utils 0.8.17", + "crossbeam-utils 0.8.18", "dashmap", "skeptic", "smallvec 1.11.2", @@ -2198,9 +2198,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -2240,7 +2240,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2451,7 +2451,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2498,7 +2498,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2606,7 +2606,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" dependencies = [ - "crossbeam-utils 0.8.17", + "crossbeam-utils 0.8.18", "libc", "mach2", "once_cell", @@ -2798,7 +2798,7 @@ dependencies = [ "async-trait", "bytes 1.5.0", "combine", - "futures 0.3.29", + "futures 0.3.30", "futures-util", "itoa 1.0.10", "percent-encoding 2.3.1", @@ -3047,11 +3047,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3066,7 +3066,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "585480e3719b311b78a573db1c9d9c4c1f8010c2dee4cc59c2efe58ea4dbc3e1" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.7", "cssparser 0.31.2", "ego-tree", "html5ever 0.26.0", @@ -3178,7 +3178,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -3414,9 +3414,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.42" +version = "2.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" +checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", @@ -3474,15 +3474,15 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall 0.4.1", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3655,7 +3655,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -3993,7 +3993,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", "wasm-bindgen-shared", ] @@ -4027,7 +4027,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4056,7 +4056,7 @@ checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "websurfx" -version = "1.6.8" +version = "1.7.3" dependencies = [ "actix-cors", "actix-files", @@ -4070,7 +4070,7 @@ dependencies = [ "env_logger", "error-stack", "fake-useragent", - "futures 0.3.29", + "futures 0.3.30", "lightningcss", "log", "maud", @@ -4324,5 +4324,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", - "syn 2.0.42", + "syn 2.0.43", ] diff --git a/Cargo.toml b/Cargo.toml index 00be915..b80fc2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "1.6.8" +version = "1.7.3" edition = "2021" description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind." repository = "https://github.com/neon-mmd/websurfx" From 5b4864424a3f740f13749185505385ed66f46644 Mon Sep 17 00:00:00 2001 From: Siddharth Tiwari <71864026+Siddh744542@users.noreply.github.com> Date: Sun, 31 Dec 2023 15:27:50 +0530 Subject: [PATCH 22/32] :zap: perf: Compression for the page responses of the search engine (#472) --- Cargo.toml | 2 +- src/lib.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b80fc2b..c577cf4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ serde = {version="1.0.190", default-features=false, features=["derive"]} serde_json = {version="1.0.108", 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-web = {version="4.4.0", features = ["cookies", "macros", "compress-brotli"], 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} diff --git a/src/lib.rs b/src/lib.rs index 0d8f49d..ec35273 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,12 @@ use crate::server::router; use actix_cors::Cors; use actix_files as fs; use actix_governor::{Governor, GovernorConfigBuilder}; -use actix_web::{dev::Server, http::header, middleware::Logger, web, App, HttpServer}; +use actix_web::{ + dev::Server, + http::header, + middleware::{Compress, Logger}, + web, App, HttpServer, +}; use cache::cacher::{Cacher, SharedCache}; use config::parser::Config; use handler::{file_path, FileType}; @@ -73,6 +78,8 @@ pub fn run( ]); App::new() + // Compress the responses provided by the server for the client requests. + .wrap(Compress::default()) .wrap(Logger::default()) // added logging middleware for logging. .app_data(web::Data::new(config.clone())) .app_data(cache.clone()) From 5020f36c90a409e53800a1efe982d199d406ccab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D1=82=D0=B8=D0=B9=20=D0=92=D0=B0?= =?UTF-8?q?=D1=80=D1=82=D0=B0=D0=BD=D1=8F=D0=BD?= <72815747+loikx@users.noreply.github.com> Date: Sun, 31 Dec 2023 13:31:07 +0300 Subject: [PATCH 23/32] :recycle: refactor: standardize the `content-type` header by using an enum value over typing it manually (#474) * :recycle: refactor: change content-type * :bug: fix: change parameters that were passed to the settings function --------- Co-authored-by: neon_arch --- src/server/router.rs | 80 +++++++++++++++++-------------------- src/server/routes/search.rs | 24 +++++------ 2 files changed, 47 insertions(+), 57 deletions(-) diff --git a/src/server/router.rs b/src/server/router.rs index 74b8bfa..c46e79d 100644 --- a/src/server/router.rs +++ b/src/server/router.rs @@ -6,22 +6,20 @@ use crate::{ config::parser::Config, handler::{file_path, FileType}, }; -use actix_web::{get, web, HttpRequest, HttpResponse}; +use actix_web::{get, http::header::ContentType, web, HttpRequest, HttpResponse}; 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(config: web::Data) -> Result> { - Ok(HttpResponse::Ok() - .content_type("text/html; charset=utf-8") - .body( - crate::templates::views::index::index( - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - ) - .0, - )) + Ok(HttpResponse::Ok().content_type(ContentType::html()).body( + crate::templates::views::index::index( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + ) + .0, + )) } /// Handles the route of any other accessed route/page which is not provided by the @@ -29,16 +27,14 @@ pub async fn index(config: web::Data) -> Result, ) -> Result> { - Ok(HttpResponse::Ok() - .content_type("text/html; charset=utf-8") - .body( - crate::templates::views::not_found::not_found( - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - ) - .0, - )) + Ok(HttpResponse::Ok().content_type(ContentType::html()).body( + crate::templates::views::not_found::not_found( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + ) + .0, + )) } /// Handles the route of robots.txt page of the `websurfx` meta search engine website. @@ -47,23 +43,21 @@ pub async fn robots_data(_req: HttpRequest) -> Result) -> Result> { - Ok(HttpResponse::Ok() - .content_type("text/html; charset=utf-8") - .body( - crate::templates::views::about::about( - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - ) - .0, - )) + Ok(HttpResponse::Ok().content_type(ContentType::html()).body( + crate::templates::views::about::about( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + ) + .0, + )) } /// Handles the route of settings page of the `websurfx` meta search engine website. @@ -71,16 +65,14 @@ pub async fn about(config: web::Data) -> Result, ) -> Result> { - Ok(HttpResponse::Ok() - .content_type("text/html; charset=utf-8") - .body( - crate::templates::views::settings::settings( - config.safe_search, - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - &config.upstream_search_engines, - )? - .0, - )) + Ok(HttpResponse::Ok().content_type(ContentType::html()).body( + crate::templates::views::settings::settings( + config.safe_search, + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + &config.upstream_search_engines, + )? + .0, + )) } diff --git a/src/server/routes/search.rs b/src/server/routes/search.rs index 9261051..bdd5662 100644 --- a/src/server/routes/search.rs +++ b/src/server/routes/search.rs @@ -11,7 +11,7 @@ use crate::{ }, results::aggregator::aggregate, }; -use actix_web::{get, web, HttpRequest, HttpResponse}; +use actix_web::{get, http::header::ContentType, web, HttpRequest, HttpResponse}; use regex::Regex; use std::{ fs::File, @@ -68,18 +68,16 @@ pub async fn search( get_results(page + 1) ); - Ok(HttpResponse::Ok() - .content_type("text/html; charset=utf-8") - .body( - crate::templates::views::search::search( - &config.style.colorscheme, - &config.style.theme, - &config.style.animation, - query, - &results?, - ) - .0, - )) + Ok(HttpResponse::Ok().content_type(ContentType::html()).body( + crate::templates::views::search::search( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + query, + &results?, + ) + .0, + )) } None => Ok(HttpResponse::TemporaryRedirect() .insert_header(("location", "/")) From 50aa52c4850263a6a12cdd983d79ad986205b7ee Mon Sep 17 00:00:00 2001 From: Jann Marc Villablanca <31008330+jfvillablanca@users.noreply.github.com> Date: Mon, 1 Jan 2024 19:57:31 +0800 Subject: [PATCH 24/32] =?UTF-8?q?=E2=9C=A8=20`Bing`=20for=20the=20search?= =?UTF-8?q?=20engine=20(#473)=20(#473)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: add closing curly brace - accidentally removed from previous PR. i hope i did not ruin some build * feat: implement mojeek engine * Merge branch 'rolling' into FEAT_316_bing_search_engine * ✨ feat: implement bing engine * Fix: include cookie string to header_map * Fix: include tags from upstream search * Merge branch 'rolling' into FEAT_316_bing_search_engine Co-authored-by: neon-mmd <132049916+neon-mmd@users.noreply.github.com> --- src/engines/bing.rs | 124 ++++++++++++++++++++++++++++++++++++ src/engines/mod.rs | 1 + src/models/engine_models.rs | 4 ++ websurfx/config.lua | 1 + 4 files changed, 130 insertions(+) create mode 100644 src/engines/bing.rs diff --git a/src/engines/bing.rs b/src/engines/bing.rs new file mode 100644 index 0000000..84dbf93 --- /dev/null +++ b/src/engines/bing.rs @@ -0,0 +1,124 @@ +//! The `bing` module handles the scraping of results from the bing search engine +//! by querying the upstream bing search engine with user provided query and with a page +//! number if provided. + +use std::collections::HashMap; + +use regex::Regex; +use reqwest::header::HeaderMap; +use reqwest::Client; +use scraper::Html; + +use crate::models::aggregation_models::SearchResult; + +use crate::models::engine_models::{EngineError, SearchEngine}; + +use error_stack::{Report, Result, ResultExt}; + +use super::search_result_parser::SearchResultParser; + +/// A new Bing engine type defined in-order to implement the `SearchEngine` trait which allows to +/// reduce code duplication as well as allows to create vector of different search engines easily. +pub struct Bing { + /// The parser, used to interpret the search result. + parser: SearchResultParser, +} + +impl Bing { + /// Creates the Bing parser. + pub fn new() -> Result { + Ok(Self { + parser: SearchResultParser::new( + ".b_results", + ".b_algo", + "h2 a", + ".tpcn a.tilk", + ".b_caption p", + )?, + }) + } +} + +#[async_trait::async_trait] +impl SearchEngine for Bing { + async fn results( + &self, + query: &str, + page: u32, + user_agent: &str, + client: &Client, + _safe_search: u8, + ) -> Result, EngineError> { + // Bing uses `start results from this number` convention + // So, for 10 results per page, page 0 starts at 1, page 1 + // starts at 11, and so on. + let results_per_page = 10; + let start_result = results_per_page * page + 1; + + let url: String = match page { + 0 => { + format!("https://www.bing.com/search?q={query}") + } + _ => { + format!("https://www.bing.com/search?q={query}&first={start_result}") + } + }; + + let query_params: Vec<(&str, &str)> = vec![ + ("_EDGE_V", "1"), + ("SRCHD=AF", "NOFORM"), + ("_Rwho=u", "d"), + ("bngps=s", "0"), + ("_UR=QS=0&TQS", "0"), + ("_UR=QS=0&TQS", "0"), + ]; + + let mut cookie_string = String::new(); + for (k, v) in &query_params { + cookie_string.push_str(&format!("{k}={v}; ")); + } + + let header_map = HeaderMap::try_from(&HashMap::from([ + ("USER_AGENT".to_string(), user_agent.to_string()), + ("REFERER".to_string(), "https://google.com/".to_string()), + ( + "CONTENT_TYPE".to_string(), + "application/x-www-form-urlencoded".to_string(), + ), + ("COOKIE".to_string(), cookie_string), + ])) + .change_context(EngineError::UnexpectedError)?; + + let document: Html = Html::parse_document( + &Bing::fetch_html_from_upstream(self, &url, header_map, client).await?, + ); + + // Bing is very aggressive in finding matches + // even with the most absurd of queries. ".b_algo" is the + // class for the list item of results + if let Some(no_result_msg) = self.parser.parse_for_no_results(&document).nth(0) { + if no_result_msg + .value() + .attr("class") + .map(|classes| classes.contains("b_algo")) + .unwrap_or(false) + { + return Err(Report::new(EngineError::EmptyResultSet)); + } + } + + let re_span = Regex::new(r#".*?(?: ·|)"#).unwrap(); + let re_strong = Regex::new(r#"(|)"#).unwrap(); + + // scrape all the results from the html + self.parser + .parse_for_results(&document, |title, url, desc| { + Some(SearchResult::new( + &re_strong.replace_all(title.inner_html().trim(), ""), + url.value().attr("href").unwrap(), + &re_span.replace_all(desc.inner_html().trim(), ""), + &["bing"], + )) + }) + } +} diff --git a/src/engines/mod.rs b/src/engines/mod.rs index d56ec6f..a93c9c2 100644 --- a/src/engines/mod.rs +++ b/src/engines/mod.rs @@ -3,6 +3,7 @@ //! provide a standard functions to be implemented for all the upstream search engine handling //! code. Moreover, it also provides a custom error for the upstream search engine handling code. +pub mod bing; pub mod brave; pub mod duckduckgo; pub mod librex; diff --git a/src/models/engine_models.rs b/src/models/engine_models.rs index 2a698d5..3108e6e 100644 --- a/src/models/engine_models.rs +++ b/src/models/engine_models.rs @@ -166,6 +166,10 @@ impl EngineHandler { let engine = crate::engines::mojeek::Mojeek::new()?; ("mojeek", Box::new(engine)) } + "bing" => { + let engine = crate::engines::bing::Bing::new()?; + ("bing", Box::new(engine)) + } _ => { return Err(Report::from(EngineError::NoSuchEngineFound( engine_name.to_string(), diff --git a/websurfx/config.lua b/websurfx/config.lua index ae7a6bb..ce2d609 100644 --- a/websurfx/config.lua +++ b/websurfx/config.lua @@ -65,4 +65,5 @@ upstream_search_engines = { Startpage = false, LibreX = false, Mojeek = false, + Bing = false, } -- select the upstream search engines from which the results should be fetched. From 62459c68e8b75de45f2462bae34e6c05b6183be6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 06:05:57 +0000 Subject: [PATCH 25/32] build(deps): bump rust from 1.74.0-alpine3.18 to 1.75.0-alpine3.18 (#475) --- Dockerfile | 2 +- dev.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 83c7fb3..6795a2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM rust:1.74.0-alpine3.18 AS chef +FROM --platform=$BUILDPLATFORM rust:1.75.0-alpine3.18 AS chef # We only pay the installation cost once, # it will be cached from the second build onwards RUN apk add --no-cache alpine-sdk musl-dev g++ make libcrypto3 libressl-dev upx perl build-base diff --git a/dev.Dockerfile b/dev.Dockerfile index 098abbf..5c4334d 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -1,5 +1,5 @@ # Create Builder image -FROM --platform=$BUILDPLATFORM rust:1.74.0-alpine3.18 +FROM --platform=$BUILDPLATFORM rust:1.75.0-alpine3.18 # Install required dependencies RUN apk add --no-cache alpine-sdk musl-dev g++ make libcrypto3 libressl-dev perl build-base From 649e0db5cb07ee5c9c6f239821819deabdd4f007 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 06:11:14 +0000 Subject: [PATCH 26/32] build(deps): bump actions/labeler from 4 to 5 (#477) --- .github/workflows/pr_labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_labeler.yml b/.github/workflows/pr_labeler.yml index bc7e72b..473e4cc 100644 --- a/.github/workflows/pr_labeler.yml +++ b/.github/workflows/pr_labeler.yml @@ -9,7 +9,7 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v5 with: sync-labels: true dot: true From af3385d1c2fe8a4ecf13108f8ab75923bc2c58bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 09:31:29 +0300 Subject: [PATCH 27/32] build(deps): bump actions/stale from 8 to 9 (#476) Bumps [actions/stale](https://github.com/actions/stale) from 8 to 9. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v8...v9) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index c4d68e0..c444b5e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -19,7 +19,7 @@ jobs: pull-requests: write steps: - - uses: actions/stale@v8 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'Stale issue message' From ebd69ff427fb45a4f2f56db6d07bf5f3c33903e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 09:40:46 +0300 Subject: [PATCH 28/32] :arrow_up: build(deps): bump serde_json from 1.0.108 to 1.0.109 (#478) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.108 to 1.0.109. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.108...v1.0.109) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: neon_arch --- Cargo.lock | 5 +++-- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 398eb1b..e69f94f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,6 +82,7 @@ dependencies = [ "ahash 0.8.7", "base64 0.21.5", "bitflags 2.4.1", + "brotli", "bytes 1.5.0", "bytestring", "derive_more", @@ -3183,9 +3184,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "cb0652c533506ad7a2e353cce269330d6afd8bdfb6d75e0ace5b35aacbd7b9e9" dependencies = [ "itoa 1.0.10", "ryu", diff --git a/Cargo.toml b/Cargo.toml index c577cf4..a6da88b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ path = "src/bin/websurfx.rs" 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} +serde_json = {version="1.0.109", 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", "compress-brotli"], default-features=false} From c73cb838e2f8438c1d72ae077b709be5137f6e0d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:08:59 +0300 Subject: [PATCH 29/32] :arrow_up: build(deps): bump minify-js from 0.5.6 to 0.6.0 (#479) Bumps [minify-js](https://github.com/wilsonzlin/minify-js) from 0.5.6 to 0.6.0. - [Commits](https://github.com/wilsonzlin/minify-js/compare/v0.5.6...v0.6.0) --- updated-dependencies: - dependency-name: minify-js dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: neon_arch --- Cargo.lock | 9 +++++---- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e69f94f..fb31fc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2029,10 +2029,11 @@ dependencies = [ [[package]] name = "minify-js" -version = "0.5.6" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22d6c512a82abddbbc13b70609cb2beff01be2c7afff534d6e5e1c85e438fc8b" +checksum = "b1fa5546ee8bd66024113e506cabe4230e76635a094c06ea2051b66021dda92e" dependencies = [ + "aho-corasick 0.7.20", "lazy_static", "parse-js", ] @@ -2329,9 +2330,9 @@ dependencies = [ [[package]] name = "parse-js" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec3b11d443640ec35165ee8f6f0559f1c6f41878d70330fe9187012b5935f02" +checksum = "2742b5e32dcb5930447ed9f9e401a7dfd883867fc079c4fac44ae8ba3593710e" dependencies = [ "aho-corasick 0.7.20", "bumpalo", diff --git a/Cargo.toml b/Cargo.toml index a6da88b..7e11c92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ tempfile = {version="3.8.0", default-features=false} [build-dependencies] lightningcss = {version="1.0.0-alpha.50", default-features=false, features=["grid"]} -minify-js = {version="0.5.6", default-features=false} +minify-js = {version="0.6.0", default-features=false} [profile.dev] opt-level = 0 From 92a141c1c52e13cb2085c6bdf06e74d806810a8e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:15:12 +0300 Subject: [PATCH 30/32] :arrow_up: build(deps): bump redis from 0.23.3 to 0.24.0 (#480) Bumps [redis](https://github.com/redis-rs/redis-rs) from 0.23.3 to 0.24.0. - [Release notes](https://github.com/redis-rs/redis-rs/releases) - [Commits](https://github.com/redis-rs/redis-rs/compare/redis-0.23.3...redis-0.24.0) --- updated-dependencies: - dependency-name: redis dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: neon_arch --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb31fc2..00f0bef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2792,9 +2792,9 @@ dependencies = [ [[package]] name = "redis" -version = "0.23.3" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f49cdc0bb3f412bf8e7d1bd90fe1d9eb10bc5c399ba90973c14662a27b3f8ba" +checksum = "c580d9cbbe1d1b479e8d67cf9daf6a62c957e6846048408b80b43ac3f6af84cd" dependencies = [ "arc-swap", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 7e11c92..c9dfc0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ 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} +redis = {version="0.24.0", features=["tokio-comp","connection-manager"], default-features = false, optional = true} 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} From 3a97a6f621385e0484de822a572144407e38f19b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:21:40 +0300 Subject: [PATCH 31/32] :arrow_up: build(deps): bump async-trait from 0.1.75 to 0.1.76 (#481) Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.75 to 0.1.76. - [Release notes](https://github.com/dtolnay/async-trait/releases) - [Commits](https://github.com/dtolnay/async-trait/compare/0.1.75...0.1.76) --- updated-dependencies: - dependency-name: async-trait dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: neon_arch --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 00f0bef..203b018 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -364,9 +364,9 @@ checksum = "9338790e78aa95a416786ec8389546c4b6a1dfc3dc36071ed9518a9413a542eb" [[package]] name = "async-trait" -version = "0.1.75" +version = "0.1.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" +checksum = "531b97fb4cd3dfdce92c35dedbfdc1f0b9d8091c8ca943d6dae340ef5012d514" dependencies = [ "proc-macro2 1.0.71", "quote 1.0.33", diff --git a/Cargo.toml b/Cargo.toml index c9dfc0a..c57ac7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ mlua = {version="0.9.1", features=["luajit", "vendored"], default-features=false redis = {version="0.24.0", features=["tokio-comp","connection-manager"], default-features = false, optional = true} 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} +async-trait = {version="0.1.76", 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} From 33846cee343a110ba6b9b3a74e0b0efa94513c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D1=82=D0=B8=D0=B9=20=D0=92=D0=B0?= =?UTF-8?q?=D1=80=D1=82=D0=B0=D0=BD=D1=8F=D0=BD?= <72815747+loikx@users.noreply.github.com> Date: Sat, 6 Jan 2024 21:17:11 +0300 Subject: [PATCH 32/32] =?UTF-8?q?=F0=9F=92=84=20style:=20replace=20the=20s?= =?UTF-8?q?earch=20button=20with=20a=20magnifying=20glass=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: neon_arch --- public/images/magnifying_glass.svg | 1 + public/static/themes/simple.css | 8 ++++++++ src/templates/partials/bar.rs | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 public/images/magnifying_glass.svg diff --git a/public/images/magnifying_glass.svg b/public/images/magnifying_glass.svg new file mode 100644 index 0000000..5793e02 --- /dev/null +++ b/public/images/magnifying_glass.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/static/themes/simple.css b/public/static/themes/simple.css index ff05d70..3990799 100644 --- a/public/static/themes/simple.css +++ b/public/static/themes/simple.css @@ -95,6 +95,14 @@ button { color: var(--background-color); font-weight: 600; letter-spacing: 0.1rem; + position: relative; +} + +.search_bar button img { + position:absolute; + left:50%; + top:50%; + transform:translate(-50%, -50%); } .search_bar button:active { diff --git a/src/templates/partials/bar.rs b/src/templates/partials/bar.rs index 13f78a8..ebf89fe 100644 --- a/src/templates/partials/bar.rs +++ b/src/templates/partials/bar.rs @@ -16,6 +16,8 @@ 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"} + button type="submit" onclick="searchWeb()" { + img src="./images/magnifying_glass.svg" alt="Info icon for error box"; + } ) }