Commit graph

218 commits

Author SHA1 Message Date
jazzzooo 223b3487c3 [fix] spelling 2023-09-18 16:20:27 +02:00
Markus Heiser 935aed7ca4 [feature] dark theme for code highlighter in the result list
Closes: https://github.com/searxng/searxng/issues/1354

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-09-11 12:27:56 +02:00
Markus Heiser 15a3dbf7a0 [fix] preferences - layout of the "special queries" tab
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-09-09 00:39:51 +02:00
Bnyro e5535ec078 [feat] settings: replace boolean select preferences with checkboxes 2023-08-27 21:23:43 +02:00
Bnyro 13d801b75d [feat] results: show source of suggested answer 2023-08-18 19:07:14 +02:00
mrpaulblack 621b09b9b9 [fix] preferences: change engine table category colspan to 8
* this is a small fix to increase the colspan of the category in engine preferences from 7 to 8, since there was a column added
=> fixing a small fallout from 4731290317
2023-08-14 07:11:06 +02:00
Bnyro 4731290317 [mod] settings: show weight of each instance 2023-08-10 10:50:14 +02:00
Markus Heiser efea962504 [fix] simple template: preferences - add missing icon_smal import
Related: https://github.com/searxng/searxng/commit/2149e88bdd64#r119535272
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-06-28 18:36:52 +02:00
Markus Heiser 80aaef6c95
Merge pull request #2357 / limiter -> botdetection
The monolithic implementation of the limiter was divided into methods and
implemented in the Python package searx.botdetection.  Detailed documentation on
the methods has been added.

The methods are divided into two groups:

1. Probe HTTP headers

- Method http_accept
- Method http_accept_encoding
- Method http_accept_language
- Method http_connection
- Method http_user_agent

2. Rate limit:

- Method ip_limit
- Method link_token (new)

The (reduced) implementation of the limiter is now in the module
searx.botdetection.limiter.  The first group was transferred unchanged to this
module.  The ip_limit contains the sliding windows implemented by the limiter so
far.

This merge also fixes some long outstandig issue:

- limiter does not evaluate the Accept-Language correct [1]
- limiter needs a IPv6 prefix to block networks instead of IPs [2]

Without additional configuration the limiter works as before (apart from the
bugfixes).  For the commissioning of additional methods (link_toke), a
configuration must be made in an additional configuration file.  Without this
configuration, the limiter runs as before (zero configuration).

The ip_limit Method implements the sliding windows of the vanilla limiter,
additionally the link_token method can be used in this method.  The link_token
method can be used to investigate whether a request is suspicious. To activate
the link_token method in the ip_limit method add the following to your
/etc/searxng/limiter.toml::

    [botdetection.ip_limit]
    link_token = true


[1] https://github.com/searxng/searxng/issues/2455
[2] https://github.com/searxng/searxng/issues/2477
2023-06-03 06:00:15 +02:00
Markus Heiser 1a1ab34d9d [fix] URL percent-encoding in translations fail in babel
Closes: https://github.com/searxng/searxng/issues/2482
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-06-02 20:30:41 +02:00
Markus Heiser 2149e88bdd [mod] template preferences: split into elements (no functional change)
HINT: this patch has no functional change / it is the preparation for following
      changes and bugfixes

Over the years, the preferences template became an unmanageable beast.  To make
the source code more readable the monolith is splitted into elements.  The
splitting into elements also has the advantage that a new template can make use
of them.

The reversed checkbox is a quirk that is only used in the prefereces and must be
eliminated in the long term.  For this the macro 'checkbox_onoff_reversed' was
added to the preferences.html template.  The 'checkbox' macro is also a quirk of
the preferences.html we don't want to use in other templates (it is an
input-checkbox in a HTML form that was misused for status display).

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-06-02 19:05:43 +02:00
Markus Heiser 1ec325adcc [mod] limiter -> botdetection: modularization and documentation
In order to be able to meet the outstanding requirements, the implementation is
modularized and supplemented with documentation.

This patch does not contain functional change, except it fixes issue #2455

----

Aktivate limiter in the settings.yml and simulate a bot request by::

    curl -H 'Accept-Language: de-DE,en-US;q=0.7,en;q=0.3' \
         -H 'Accept: text/html'
         -H 'User-Agent: xyz' \
         -H 'Accept-Encoding: gzip' \
         'http://127.0.0.1:8888/search?q=foo'

In the LOG:

    DEBUG   searx.botdetection.link_token : missing ping for this request: .....

Since ``BURST_MAX_SUSPICIOUS = 2`` you can repeat the query above two time
before you get a "Too Many Requests" response.

Closes: https://github.com/searxng/searxng/issues/2455
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-05-29 14:54:56 +02:00
Markus Heiser 5226044c13 [mod] limiter: add random token to the limiter URL
By adding a random component in the limiter URL a bot can no longer send a ping
by request a static URL.

Related: https://github.com/searxng/searxng/pull/2357#issuecomment-1518525094
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-05-29 14:54:56 +02:00
Markus Heiser dba569462d [mod] limiter: reduce request rates for requests without a ping
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-05-29 14:54:56 +02:00
Markus Heiser 3ca97cf5e3 [fix] simple theme: move engine alerts in case of no results into sidebar
If there were no results but errors in the engines then the error dialogs of the
engines was displayed in the result list.

With the new design errors of the engines should only be displayed in the
sidebar and at the same time duplications of the (template) code will be
avoided.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-05-28 12:19:32 +02:00
mrpaulblack f087959b02 [mod] simple theme: build design for details (collapsables)
* set border top and bottom on sidebar collasables
* inrease peading on summary so its easier to click on mobile
* remove margins and add flex wrapper to normalize elements in sidebar
2023-05-28 12:19:32 +02:00
Markus Heiser b7e315563d [mod] simple theme: collaps/expand elements in the sidebar
Make elements in the sidebar collapse able.  Except infoboxes all elements in
the sidebar are collapsed by default.

By folding out the sidebar elements, the UI looks less cluttered.  Especially on
small devices like smartphones, where the sidebar is above the results list, the
UX should be improved [1].

[1] https://github.com/searxng/searxng/issues/2140

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-05-28 12:19:32 +02:00
Markus Heiser ebe22a4319 [fix] typo: dues --> does
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-05-22 13:18:22 +02:00
Markus Heiser 7d17d37ac7 [fix] don't show a category if there is no active engine in
When deactivate all the engines of a category, this category should disappeare.
This feature has been lost in commit 8e9ad1cc.

For better readability, webapp.get_enabled_categories() has been rewritten with
identical functionality.

Related:

- https://github.com/searxng/searxng/issues/1020
- https://github.com/searxng/searxng/issues/1604

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-10 09:22:21 +02:00
Markus Heiser f117f969d8 [mod] in the preference page, show !bang of subgrouping categories
The names of the subgrouping categories in the preference page are translated,
to use this categories the user needs to know by which !bang the category can be
selected.  Related to "Make 'non tab category' bangs discoverable" in [#690].

Related:

- [#690] https://github.com/searxng/searxng/issues/690
- https://github.com/searxng/searxng/issues/1604
- https://github.com/searxng/searxng/pull/1545

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-08 11:10:14 +02:00
Markus Heiser 2ffd446e5c [mod] clarify the difference of the default category and subgrouping
This PR does no functional change it is just an attempt to make more clear in
the code, what a default category is and what a subcategory is.  The previous
name 'others' leads to confusion with the **category 'other'**.

If a engine is not assigned to a category, the default is assigned::

    DEFAULT_CATEGORY = 'other'

If an engine has only one category and this category is shown as tab in the user
interface, this engine has no further subgrouping::

    NO_SUBGROUPING = 'without further subgrouping'

Related:

- https://github.com/searxng/searxng/issues/1604
- https://github.com/searxng/searxng/pull/1545

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-07 11:03:25 +02:00
Markus Heiser c9cd376186 [mod] replace searx.languages by searx.sxng_locales
With the language and region tags from the EngineTraitsMap the handling of
SearXNG's tags of languages and regions has been normalized and is no longer
a *mystery*.  The "languages" became "locales" that are supported by babel and
by this, the update_engine_traits.py can be simplified a lot.

Other code places can be simplified as well, but these simplifications
should (respectively can) only be done when none of the engines work with the
deprecated EngineTraits.supported_languages interface anymore.

This commit replaces searx.languages by searx.sxng_locales and fix the naming of
some names from "language" to "locale" (e.g. language_codes --> sxng_locales).

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24 10:37:42 +01:00
Alexandre Flament 6748e8e2d5 Add "Auto-detected" as a language.
When the user choose "Auto-detected", the choice remains on the following queries.
The detected language is displayed.

For example "Auto-detected (en)":
* the next query language is going to be auto detected
* for the current query, the detected language is English.

This replace the autodetect_search_language plugin.
2023-02-17 15:17:36 +00:00
Lea a530ac4099 fix: typo in suggestions 2023-02-10 15:33:25 +01:00
mrpaulblack 8ead23347f [fix] use input elements for pagination requests
* use html input elements instead of buttons for the pagination forms at the bottom of the result page
* move the less section that hides the pagination number widget on mobile to the mobile section
* clean up the less code for styling the numbers of the pagination widget
* fix: add the margin for box results (like in news category) to the bottom of the result to have a margin between pagination widget and article result
2023-01-23 22:56:55 +01:00
llmII d2b2300ee1 Feature: Pagination Widget with list of numbers.
Adds to the navigation widget, preserving forward/backward nav, and
inserting a list of clickable page numbers between them.

Phone sized devices continue without this widget as deterministic
display under small screen sizes has not been solved.

The widget is agnostic to the actual amount of pages there are that one
can navigate to and as such shows all plausible, albeit not necessarilly
valid, possibilities.

This widget does not interfere with infinite scroll in any fashion.
2023-01-23 21:22:06 +01:00
allixx 1407a055b2 [simple theme] set tab index for search page input field #1891
Previously it took five tab keypresses to reach search input field
on search results page. Now one tab press is enough.
2023-01-08 13:41:48 +03:00
Markus Heiser ba8959ad7c [fix] typos / reported by @kianmeng in searx PR-3366
[PR-3366] https://github.com/searx/searx/pull/3366

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-09-27 18:32:14 +02:00
Markus Heiser b424ee255e [mod] paper.html: simplify template by using result_link macro
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-09-24 16:13:36 +02:00
Markus Heiser 3198c906af [mod] paper.html: add links to doi resolver
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-09-24 14:19:51 +02:00
Alexandre Flament d6446be38f [mod] science category: various update of about PR 1705 2022-09-23 20:52:55 +02:00
Alexandre FLAMENT 5ba831d6a8 Add paper.html result template 2022-09-23 20:45:58 +02:00
Markus Heiser 8b40e68c56 [fix] wording: SearXNG is 'open' and not 'hackable'
The word "hackable" may arouse interest in programmers to participate in the
development, but it scares the ordinary user.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-09-21 17:10:35 +02:00
Alexandre Flament 691c0ed6b9
Merge pull request #1743 from dalf/update_about_metrics
Update about the metrics
2022-09-04 11:29:28 +02:00
Markus Heiser ad8ffd222c [mod] option 'ui: cache_url:' to configure internet cache or archive
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-09-04 09:42:20 +02:00
Alexandre FLAMENT 66f72a006f template: when enable_metrics are disabled, hide the empty stats
when metrics are disabled:
* hide the link to /stats at the bottom of the pages
* in /preferences, hide the columns "Response time" and "Reliability"
2022-09-02 08:52:23 +00:00
Alexandre FLAMENT 94a28ebe53 Stats: display only the score per result, no anymore the score 2022-09-02 08:30:38 +00:00
Markus Heiser 3b0f9c07b2 [fix] improve OpenSearch description
Some HTTP-Clients do have issues with the ``opensearch.xml`` from SearXNG
(related [1][2]) while other OpenSearch descriptions[3] (e.g. from qwant) work
flawles.

Inspired by the OpenSearch description from qwant and with informations from the
specification[4] the ``opensearch.xml`` has been *improved*.

- convert `<Url>` methods from lower case to upper case (`POST`|`GET`)
- add `<moz:SearchForm>` and `xmlns:moz="http://www.mozilla.org/2006/browser/search/"`
- add `<Query role="example" searchTerms="SearXNG" />`  [4]

  OpenSearch description documents should include at least one Query element of
  `role="example"` that is expected to return search results. Search clients may
  use this example query to validate that the search engine is working properly.

- modified `<LongName>` to SearXNG
- modified `<Description>` the word 'hackable' scares uninitiated users and was removed
- add the `type="image/png"` to `<Image>`

Test can be done by::

    make run

Visit http://127.0.0.1:8888/ and add the search engine to your WEB-Browser /
test with different WEB-Browser from desktop and Smartphones (are there any iOS
user here, please test on Safari and Chrome).

[1] https://app.element.io/#/room/#searxng:matrix.org/$xN_abdKhNqUlgXRBrb_9F3pqOxnSzGQ1TG0s0G9hQVw
[2] https://github.com/searxng/searxng/issues/431
[3] https://developer.mozilla.org/en-US/docs/Web/OpenSearch
[4] https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#the-query-element

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-08-11 19:04:36 +02:00
Léon Tiekötter d339e97727
[fix] preferences: missing option value
Fix missing option value "0".
2022-07-17 19:51:12 +02:00
Léon Tiekötter 8e509941b9
[mod] allow brand.issue_url to overwrite the step1 url 2022-07-10 18:43:53 +02:00
Alexandre Flament eb489c45ea Submit GH bug: ask the user to do some checks before submitting a new issue 2022-07-08 09:04:57 +02:00
Alexandre Flament df837d8b1b
Merge pull request #1428 from return42/fix-center_aligment
fix typo and document preference 'center_alignment' in the 'ui' section
2022-07-07 09:43:12 +02:00
Xavier horwood 61ee370e18 [mod] link to public-instances can be set to hidden
Some administrators may want to hide the link to public_instances: If you run a
private instance for a company that wants there employees to use the private
instance instead of any of the public instances.
2022-07-04 13:26:01 +02:00
Markus Heiser 241bde5ae3 [fix] typo: add missing 'n' in center_aligment --> center_alignment
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-07-03 17:35:54 +02:00
Markus Heiser 4ef6263725
Merge pull request #1404 from dalf/donation_use_external_link
Donation link: default value to searxng.org, can be hidden or custom
2022-07-02 17:18:05 +02:00
Alexandre Flament 7f30ac37e9 map.html: display the intended text for the links instead of the URL
For example display "Tokyo (en)" instead of https://en.wikipedia.org/wiki/Tokyo
2022-07-02 16:51:25 +02:00
Alexandre Flament f8f239fe1f Donation link: default value to searxng.org, can be hidden or custom
Add a new setting: general.donation_url

By default the value is https://docs.searxng.org/donate.html

When the value is false, the link is hidden

When the value is true, the link goes to the infopage donation,
the administrator can create a custom page.
2022-07-02 11:29:21 +02:00
Alexandre Flament bcded7686e [build] /static 2022-07-02 10:05:43 +02:00
Alexandre Flament e3e5d2bd22 Theme: all top right icons have labels including "Preferences" 2022-07-02 10:04:35 +02:00
Alexandre Flament 86f14fd066 [build] /static 2022-06-25 20:32:04 +02:00