1
0
mirror of https://github.com/searxng/searxng.git synced 2024-09-12 16:30:33 +02:00
Commit Graph

3143 Commits

Author SHA1 Message Date
Markus Heiser
222031e975 [fix] make oscar theme more CSP compliant - col-checkbox
Add col-checkbox in::

    searx/static/themes/oscar/src/less/preferences.less

Replaced style in file::

    searx/templates/oscar/preferences.html

Reported-by: https://github.com/searxng/searxng/issues/57
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-07 08:24:48 +02:00
Markus Heiser
9d106ae972 [fix] make oscar theme more CSP compliant - default-image-style
Add default-image-style in::

    searx/static/themes/oscar/src/less/result_templates.less

Replaced style= in files::

    ./oscar/result_templates/default.html:19:        <img src="{{ image_proxify(result.img_src or result.thumbnail) }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content">
    ./oscar/result_templates/files.html:24:<img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content">

Reported-by: https://github.com/searxng/searxng/issues/57
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-07 08:20:30 +02:00
Markus Heiser
e564cef0fe [fix] make /preferences more CSP compliant - simple & oscar theme
In simple & oscar theme remove ``style=`` properties which violates CSP but seem
not to have a magnification in GUI (UX).

Fixed files::

    ./oscar/preferences.html:25:<td class="{{ label }}" style="padding: 2px">{{- "" -}}
    ./simple/preferences.html:39:<td class="{{ label }}" style="padding: 2px; width: 13rem;">{{- "" -}}
    ./simple/preferences.html:77:    <div class="engine-tooltip" style="right: 12rem;" role="tooltip" id="{{engine_name}}_reliability">
    ./simple/preferences.html:258:     <p class="text-muted" style="margin:20px 0;">

Reported-by: https://github.com/searxng/searxng/issues/57
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-07 08:20:30 +02:00
Alexandre Flament
ea60c03827 [fix] fix openstreetmap engine
close #298

This is a workaround: inside engine code, any call to function in another engine can crash
since the logger won't be initialized except if it is done explicitly.
2021-09-06 22:44:22 +02:00
Markus Heiser
aecfb2300d [mod] one logger per engine - drop obsolete logger.getChild
Remove the no longer needed `logger = logger.getChild(...)` from engines.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-06 18:05:46 +02:00
Markus Heiser
7b235a1c36 [mod] one logger per engine
Suggested-by: @dalf in https://github.com/searxng/searxng/issues/98#issuecomment-849013518
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-06 17:47:28 +02:00
Markus Heiser
0d070fde92 [build] /static 2021-09-06 11:12:17 +02:00
Markus Heiser
ad528c706e [fix] make result template map more CSP compliant - simple & oscar
Add osm-map-box in::

    searx/static/themes/__common__/less/result_templates.less

Replaced sty= in files::

    ./oscar/result_templates/map.html:64:        <div style="height:300px; width:100%; margin: 10px 0;" id="osm-map-{{ index }}"></div>
    ./simple/result_templates/map.html:65:    <div id="result-map-{{ index }}" class="invisible"><div id="osm-map-{{ index }}" style="height:300px; width:100%; margin: 10px 0;" ></div></div>

Reported-by: https://github.com/searxng/searxng/issues/57
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-06 11:08:50 +02:00
Markus Heiser
48c806954e [fix] make /preferences more CSP compliant - simple & oscar theme
in simple & oscar theme replace bar-graph's *styles* by CSP compliant
implementation in::

    searx/static/themes/__common__/less/stats.less

Fixed files::

    ./oscar/preferences.html:29:        <span style="width: calc(max(2px, 100%*{{ (stats[engine_name].time / max_rate95)|round(3) }}))" class="stacked-bar-chart-median"></span>{{- "" -}}
    ./oscar/preferences.html:30:        <span style="width: calc(100%*{{ ((stats[engine_name].rate80 - stats[engine_name].time) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate80"></span>{{- "" -}}
    ./oscar/preferences.html:31:        <span style="width: calc(100%*{{ ((stats[engine_name].rate95 - stats[engine_name].rate80) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate95"></span>{{- "" -}}
    ./simple/preferences.html:43:        <span style="width: calc(max(2px, 100%*{{ (stats[engine_name].time / max_rate95)|round(3) }}))" class="stacked-bar-chart-median"></span>{{- "" -}}
    ./simple/preferences.html:44:        <span style="width: calc(100%*{{ ((stats[engine_name].rate80 - stats[engine_name].time) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate80"></span>{{- "" -}}
    ./simple/preferences.html:45:        <span style="width: calc(100%*{{ ((stats[engine_name].rate95 - stats[engine_name].rate80) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate95"></span>{{- "" -}}

Reported-by: https://github.com/searxng/searxng/issues/57
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-06 11:08:50 +02:00
Alexandre Flament
33ea1d5909
Merge pull request #289 from return42/fix-xpath
[fix] remove minimum length of content for XPath engine
2021-09-04 15:34:18 +02:00
Alexandre Flament
39bbd15b39
Merge pull request #287 from return42/azlyrics
[enh] add engine AZLyrics.com (XPath)
2021-09-04 13:36:09 +02:00
Markus Heiser
9ff881f937 [fix] remove minimum length of content for XPath engine
Instead of raising an exception and therefore hiding all results of the engine.

It make sense to remove that requirement in order to allow the implementation of
search engines that do not always have a description.  In fact some search
engines that in 99% of the case have a description like Brave Search or Mojeek
crash completely if they for some reason included a result with no description.

To test this patch try Mojeek:

    !mjk xyz

before and after the patch.

Suggested-by: 0xhtml in https://github.com/searx/searx/discussions/2933
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-04 12:41:23 +02:00
Markus Heiser
730073b850 [enh] add suggestions to brave engine
Suggestions should be added too.

    suggestion_xpath: //div[@class="text-gray h6"]/a

You can try it with:

    !brave recurzuoin

Suggested-by: @allendema in https://github.com/searx/searx/issues/2857#issuecomment-904837023
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-04 11:38:59 +02:00
Allen
0648757e7f [enh] add engine AZLyrics.com (XPath)
Upstream example query:
  https://search.azlyrics.com/search.php?q=The+verbal+acupunture&w=lyrics&p=1

Cherry picked from [1] and slightly modified to pass yamllint test.

[1] https://github.com/allendema/searx/commit/8b6d5a0e5

Reviewed-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-04 10:58:34 +02:00
Allen
a5a0a4e106 [fix] Correct engine name in for Rumble 2021-09-04 10:22:26 +02:00
Allen
49bbd250d9 [fix] Update about section of Invidious
Another website and new documentation
2021-09-04 10:22:07 +02:00
Markus Heiser
ab4456b0d0
Merge pull request #281 from dalf/cleanup
Cleanup
2021-09-04 07:17:19 +00:00
Markus Heiser
df351937f4 [fix] typo in searx.webadapter.parse_lang
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-04 08:39:45 +02:00
searxng-bot
3120c9ca79 [translations] update
4fd5bb5a - 2021-08-27 - Allan Nordhøy <epost@anotheragency.no>
2021-09-03 07:16:39 +00:00
Alexandre Flament
a14ea6396e [mod] remove searx.raise_for_httperror
Not used anymore
2021-09-02 16:24:25 +02:00
Alexandre Flament
a7d781c49d [mod] remove remaining references to locales in settings.yml
see #247
2021-09-02 16:19:18 +02:00
Alexandre Flament
3c377c0aa8 [mod] searx.webapp: code clean up 2021-09-02 16:16:20 +02:00
Alexandre Flament
b9c73fb697 [mod] move searx/testing.py to the tests directory
move robot tests to tests.robot
manage calls "python -m tests.robot"
2021-09-02 16:01:34 +02:00
Markus Heiser
065b4dab56
Merge pull request #278 from searxng/update_data_update_ahmia_blacklist.py
Update searx.data - update_ahmia_blacklist.py
2021-09-01 06:48:55 +00:00
Markus Heiser
a7a879181d
Merge pull request #279 from searxng/update_data_update_currencies.py
Update searx.data - update_currencies.py
2021-09-01 06:46:29 +00:00
Markus Heiser
00a51fa17f
Merge pull request #280 from searxng/update_data_update_firefox_version.py
Update searx.data - update_firefox_version.py
2021-09-01 06:44:22 +00:00
dalf
9e3113865d Update searx.data - update_firefox_version.py 2021-09-01 06:23:44 +00:00
dalf
a45fc66e83 Update searx.data - update_currencies.py 2021-09-01 06:23:35 +00:00
dalf
44f7e1fcaa Update searx.data - update_ahmia_blacklist.py 2021-09-01 06:23:20 +00:00
dalf
a556d0c1aa Update searx.data - update_wikidata_units.py 2021-09-01 06:23:11 +00:00
Markus Heiser
37b3d8c33b
Merge pull request #276 from dalf/simple_eslint
Simple theme: eslint and bug fix
2021-08-31 16:13:47 +00:00
Markus Heiser
840a327564
Merge pull request #275 from koelle25/add-packagist
[enh] Add Packagist search engine
2021-08-31 16:05:24 +00:00
Kevin Köllmann
2b3687780c [enh] Add Packagist search engine (JSON)
Packagist's API: https://packagist.org/apidoc
2021-08-31 17:59:34 +02:00
Alexandre Flament
d246679dbe [build] /static 2021-08-31 15:43:28 +02:00
Alexandre Flament
f77f797f8c [mod] simple theme: fix eslint errors, fix VIM keys
* VIM keys: fix the next page and previous pages (n, p keys)
* Map: Enable the wikipedia map (the layer was initialized but not included)
2021-08-31 15:41:31 +02:00
Alexandre Flament
66a27757fd
Merge pull request #244 from return42/eslint-simple-client
[mod] simple theme - add ESLint
2021-08-31 13:24:06 +02:00
Alexandre Flament
0ee316f3d1 eslint: grunt integration 2021-08-31 12:20:23 +02:00
Markus Heiser
2948a99b6e [mod] simple theme - add ESLint
[1] https://eslint.org/
[2] https://eslint.org/docs/user-guide/configuring/
[3] https://eslint.org/docs/user-guide/command-line-interface

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-31 12:20:23 +02:00
Alexandre Flament
7dc370efe9 [enh] new issue: include information from searx.version 2021-08-31 11:45:33 +02:00
Markus Heiser
1e942435be
Merge pull request #273 from searxng/dependabot/pip/master/pylint-2.10.2
Bump pylint from 2.9.6 to 2.10.2
2021-08-31 09:08:59 +00:00
Markus Heiser
03e7d423be [pylint] Pylint 2.10 - unused-variable
Pylint 2.10 fixed [1]:

  Fixed bug with cell-var-from-loop checker: it no longer has false negatives
  when both unused-variable and used-before-assignment are disabled.

[1] https://pylint.pycqa.org/en/latest/whatsnew/2.10.html

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-31 10:51:50 +02:00
Markus Heiser
e856b563dd [pylint] Pylint 2.10 - unspecified-encoding
Pylint 2.10 added new default checks [1]:

unspecified-encoding:
  Emitted when open() is called without specifying an encoding [2]

[1] https://pylint.pycqa.org/en/latest/whatsnew/2.10.html
[2] https://github.com/PyCQA/pylint/issues/3826

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-31 10:49:36 +02:00
Markus Heiser
b83c14cf6b [pylint] Pylint 2.10 - fix use-list-literal & use-dict-literal
Pylint 2.10 added new default checks [1]:

use-list-literal
  Emitted when list() is called with no arguments instead of using []

use-dict-literal
  Emitted when dict() is called with no arguments instead of using {}

[1] https://pylint.pycqa.org/en/latest/whatsnew/2.10.html

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-31 10:40:29 +02:00
searxng-bot
9e63e20c36 [translations] update
18fae620 - 2021-08-25 - Markus Heiser <markus.heiser@darmarit.de>
2e76843c - 2021-08-25 - ewm <gnu.ewm@protonmail.com>
172a1a88 - 2021-08-25 - Alexandre Flament <alex@al-f.net>
4567065b - 2021-08-25 - Full Name <cheez.1337@mail.ru>
59d9d549 - 2021-08-25 - Markus Heiser <markus.heiser@darmarit.de>
5f135b41 - 2021-08-23 - Markus Heiser <markus.heiser@darmarit.de>
91b3a32e - 2021-08-24 - Full Name <cheez.1337@mail.ru>
0198ea11 - 2021-08-22 - Allan Nordhøy <epost@anotheragency.no>
6efc4b9f - 2021-08-22 - Markus Heiser <markus.heiser@darmarit.de>
a263af1e - 2021-08-23 - Alexandre Flament <alex@al-f.net>
713b07f7 - 2021-08-22 - Markus Heiser <markus.heiser@darmarit.de>
0c7b7859 - 2021-08-22 - Markus Heiser <markus.heiser@darmarit.de>
408c85f9 - 2021-08-20 - Alexandre Flament <alex@al-f.net>
2021-08-27 07:16:35 +00:00
Alexandre Flament
697ebeddcc [mod] searx.utils.dict_subset: rewrite with comprehension 2021-08-24 15:28:08 +02:00
Alexandre Flament
3b0f70ed0f [mod] /image_proxy: use HTTP/1 instead of HTTP/2
httpx: HTTP/2 is slow when a lot data is downloaded.
https://github.com/dalf/pyhttp-benchmark

also, the usage of HTTP/1 decreases the load average
2021-08-24 14:51:20 +02:00
Alexandre Flament
43fcaa642a [fix] image_proxy: always close the httpx respone
previously, when the content type was not an image and some other error,
the httpx response was not closed
2021-08-24 14:51:20 +02:00
Alexandre Flament
df15c655f7 [mod] /image_proxy: don't decompress images 2021-08-24 14:51:20 +02:00
Markus Heiser
29b40338d6
Merge pull request #260 from dalf/mod_locale
[mod] searx.webapp.get_locale: read locale from the preferences
2021-08-22 16:07:21 +00:00
Noémi Ványi
3d5e6e0abb [enh] google: add filter=0 to Google engine for more results
backport from searx ( 23b3b56a06ef831af0a1b30a12c26ebd50e329bb )
2021-08-21 17:46:16 +02:00
searxng-bot
eafa373cff [translations] update
b25c9d58 - 2021-08-17 - Allan Nordhøy <epost@anotheragency.no>
2021-08-20 07:16:15 +00:00
Markus Heiser
8290f70e24 [fix] /config add missing GIT_BRANCH value
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-18 19:51:07 +02:00
searxng-bot
02b6f0c370 [translations] update
fc3041a0 - 2021-08-10 - Allan Nordhøy <epost@anotheragency.no>
fcc3732d - 2021-08-06 - Allan Nordhøy <epost@anotheragency.no>
894bd655 - 2021-08-06 - Allan Nordhøy <epost@anotheragency.no>
2021-08-17 08:47:59 +00:00
Alexandre Flament
28ccf47ca4 [mod] searx.webapp.get_locale: read locale from the preferences
pre_request already set the locale.
2021-08-17 08:18:30 +02:00
Alexandre Flament
a925254c3d
Merge pull request #258 from dalf/plugin_minor_change
[mod] plugins: minor change
2021-08-16 17:10:28 +02:00
Alexandre Flament
2f363858b8 [fix] searx.search.checker.get_result() always return a dict
So checker_results['status'] == 'ok' is enough to check the checker result.
See searx/webapp.py, /preferences endpoint
2021-08-16 08:29:16 +02:00
Alexandre Flament
3f3b5d6181 [mod] plugins: minor change
required attributes: display a different message
when the attribute has the wrong type
2021-08-14 18:03:31 +02:00
Markus Heiser
15bf9fc850 [fix] settings.yml - replace http:// URLs by https://
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-07 16:43:19 +02:00
Alexandre Flament
0d20e5dfe3 [mod] searx/locales.py: language names based on Unicode CLDR
rename "oc" to "Occitan":
* https://github.com/unicode-org/cldr/blob/35.1/seed/main/oc.xml#L115
* https://oc.wikipedia.org/wiki/Occitan

see https://github.com/searxng/searxng/pull/247#issuecomment-892382001
2021-08-04 09:50:34 +02:00
Markus Heiser
809bf1a105 [mod] pylint & document searx.locales (settings.yml: remove locales)
- Add ``# lint: pylint`` header to pylint this python file.
- Fix issues reported by pylint.
- Add source code documentation of modul searx.locales

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-04 07:54:53 +02:00
Alexandre Flament
f30d01ffab [mod] settings.yml: remove locales
There are detected from the searx/translations directory
2021-08-03 15:44:45 +02:00
Alexandre Flament
bd17544f82 [fix] make test.robot: firefox profile: intl.accept_languages=en
make sure Firefox in test.robot asks for English pages
2021-08-03 15:11:51 +02:00
Alexandre Flament
7fa7177759 Update translations (pot, po) 2021-08-02 09:44:13 +02:00
Markus Heiser
e0ca749ff5
Merge pull request #242 from searxng/update_data_update_currencies.py
Update searx.data - update_currencies.py
2021-08-02 07:40:19 +00:00
Alexandre Flament
b6711ba0ad
Merge pull request #241 from searxng/update_data_update_languages.py
Update searx.data - update_languages.py
2021-08-02 09:01:57 +02:00
Markus Heiser
274edd523c [fix] get common used languages back (min_engines_per_lang = 13)
In commit 4d3f2f48d common used languages has been droped.  By reducing the
number of `min_engines_per_lang` from 15 to 13 we get theses languages back.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-01 13:04:24 +02:00
Markus Heiser
0fc1dcbfa5
Merge pull request #243 from searxng/update_data_update_wikidata_units.py
Update searx.data - update_wikidata_units.py
2021-08-01 09:42:01 +00:00
dalf
7fae5647d3 Update searx.data - update_wikidata_units.py 2021-08-01 06:24:23 +00:00
dalf
2963c83daa Update searx.data - update_currencies.py 2021-08-01 06:24:13 +00:00
dalf
4d3f2f48d2 Update searx.data - update_languages.py 2021-08-01 06:24:12 +00:00
dalf
f5389fd722 Update searx.data - update_firefox_version.py 2021-08-01 06:24:01 +00:00
Alexandre Flament
38ee88b390
Merge pull request #229 from dalf/version-from-git
version based on git
2021-07-30 18:57:00 +02:00
Alexandre Flament
4b43775c91 version based on the git repository
This commit remove the need to update the brand for GIT_URL and GIT_BRANCH:
there are read from the git repository.

It is possible to call python -m searx.version freeze to freeze the current version.
Useful when the code is installed outside git (distro package, docker, etc...)
2021-07-30 14:40:09 +02:00
Alexandre Flament
feef577f99
Merge pull request #230 from dalf/remove-zh-hant-tw
Remove zh_Hant_TW translation
2021-07-28 08:34:09 +02:00
Alexandre Flament
0b2dca088f Remove zh_Hant_TW translation
See https://github.com/searxng/searxng/issues/195#issuecomment-887518808
2021-07-27 18:54:25 +02:00
Alexandre Flament
ed0db4d61a
Merge pull request #226 from return42/hardening
[mod] hardening SearXNG instances by default (formats)
2021-07-27 11:22:18 +02:00
Alexandre Flament
24fcd7475a Revert "[brand] !!DO NOT MERGE!! this patch uses branch fix-searx.sh @return42"
This reverts commit e946c3462c.
2021-07-27 08:40:53 +02:00
Markus Heiser
beff764d74
Merge pull request #216 from return42/fix-searx.sh
normalize environment of installation tasks (shell) with YAML settings
2021-07-27 05:32:57 +00:00
Markus Heiser
80f5241387
Merge pull request #225 from return42/docs-nosql
[docs] document NoSLQ engines MongoDB and redis
2021-07-27 05:32:26 +00:00
Samuel Dudik
7a7ef9cea6 [fix] Seznam engine - some XPath selectors has been changed
Merged from https://github.com/dudik/searx/commit/5a4207759

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-27 07:13:41 +02:00
Markus Heiser
7b40c736e6 [mod] hardening SearXNG instances by default (formats)
Deny formats has been implemented in 6ed4616d.

To harden SearXNG instances by default, other formats than HTML should be
denied.  Most of JSON, RSS and CSV requests are bots [1]::

    Bots are the only users of this feature on a public instance, and they abuse
    it too much that the engines rate limit pretty quickly the IP address of the
    instance.

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

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-25 12:59:09 +02:00
Noémi Ványi
5e648e77ab [docs] document NoSLQ engines MongoDB and redis
Slightly modified merge of commit [3b192e638]

[3b192e638] https://github.com/searx/searx/commit/3b192e638

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-25 11:39:11 +02:00
Alexandre Flament
48fe83b901
Merge pull request #221 from dalf/fix-peertube_fetch_supported_languages
[fix] peertube: update _fetch_supported_languages
2021-07-25 10:30:53 +02:00
Markus Heiser
e946c3462c [brand] !!DO NOT MERGE!! this patch uses branch fix-searx.sh @return42
Do not merge this patch in master branch of SearXNG!  This branch exists only
for testing the feature branch fix-searx.sh @return42.

This patch changes the buildenv to::

    GIT_URL='https://github.com/return42/searxng'
    GIT_BRANCH='fix-searx.sh'
    SEARX_PORT='7777'
    SEARX_BIND_ADDRESS='127.0.0.12'

To test installation procedure, clone feature branch (fix-searx.sh)::

    $ cd ~/Downloads
    $ git clone --branch fix-searx.sh https://github.com/return42/searxng searxng
    $ cd searxng

    $ ./utils/searx.sh install all
    ...

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-24 16:28:15 +02:00
Markus Heiser
b6a55e223c [mod] reduce enviroment variables in shell scripts to what is needed
Not all settings from the 'brand:' section of the YAML files are needed in the
shell scripts.  This patch reduce the variables in ./utils/brand.env to what is
needed.  The following ('brand:' settings) can be removed from this file:

- ISSUE_URL
- DOCS_URL
- PUBLIC_INSTANCES
- WIKI_URL

Tasks running outside of an *installed instance*, need the following settings
from the YAML configuration:

- GIT_URL            <--> brand.git_url
- GIT_BRANCH         <--> brand.git_branch
- SEARX_URL          <--> server.base_url  (aka PUBLIC_URL)
- SEARX_PORT         <--> server.port
- SEARX_BIND_ADDRESS <--> server.bind_address

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-24 16:28:15 +02:00
Markus Heiser
fe67f1478f [fix] qwant engine - prevent API locale exception on lang 'all'
Has been reported in [1], error message::

    Error
        Error: searx.exceptions.SearxEngineAPIException
        Percentage: 0
        Parameters: ('API error::locale must be a string,locale must be one of
        the following values: en_gb, en_ie, en_us, en_ca, en_in, en_my, en_au,
        en_nz, cy_gb, gd_gb, de_de, de_ch, de_at, fr_fr, br_fr, fr_be, fr_ch,
        fr_ca, fr_ad, fc_ca, ec_ca, co_fr, es_es, es_ar, es_cl, es_co, es_mx,
        es_pe, es_ad, ca_es, ca_ad, ca_fr, eu_es, eu_fr, it_it, it_ch, pt_br,
        pt_pt, pt_ad, nl_be, nl_nl, pl_pl, zh_hk, zh_cn, fi_fi, bg_bg, et_ee,
        hu_hu, da_dk, nb_no, sv_se, ko_kr, th_th, cs_cz, ro_ro, el_gr',)
        File name: searx/engines/qwant.py:114
        Function: response
        Code: raise SearxEngineAPIException('API error::' + msg)

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

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-24 14:48:27 +02:00
Markus Heiser
ca57c7421b [fix] qwant engine - prevent exception on date/time value is None
Has been reported in [1], error messages::

  Error
       Error: ValueError
       Percentage: 0
       Parameters: ()
       File name: searx/engines/qwant.py:159
       Function: response
       Code: pub_date = datetime.fromtimestamp(item['date'], None)

    Error
        Error: TypeError
        Percentage: 0
        Parameters: ('an integer is required (got type NoneType)',)
        File name: searx/engines/qwant.py:196
        Function: response
       Code: pub_date = datetime.fromtimestamp(item['date'])

Fix timedelta from seconds to milliseconds [1], error message::

    Error
        Error: TypeError
        Percentage: 0
        Parameters: ('unsupported type for timedelta seconds component: NoneType',)
        File name: searx/engines/qwant.py:195
        Function: response
        Code: length = timedelta(seconds=item['duration'])

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

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-24 14:48:14 +02:00
Alexandre Flament
b0a12924a0 [fix] peertube: update _fetch_supported_languages
update the regex to match the changes in peertube source code
fix "make data.languages"
2021-07-23 12:03:16 +02:00
Alexandre Flament
b1100e2b7d [fix] /preferences: remove the empty engine category "social medias" (it is "social media") 2021-07-23 10:43:16 +02:00
Markus Heiser
2964a24b3d [fix] utils/build_env.py and add documentation
modified   docs/admin/engines/settings.rst
  - Fix documentation and add section 'brand'.
  - Add remarks about **buildenv** variables.
  - Add remarks about settings from environment variables $SEARX_DEBUG,
    $SEARX_PORT, $SEARX_BIND_ADDRESS and $SEARX_SECRET

modified   docs/admin/installation-searx.rst & docs/build-templates/searx.rst
   Fix template location /templates/etc/searx/settings.yml

modified   docs/dev/makefile.rst
  Add description of the 'make buildenv' target and describe
  - we have all SearXNG setups are centralized in the settings.yml file
  - why some tasks need a utils/brand.env (aka instance's buildenv)

modified   manage
  Settings file from repository's working tree are used by default and
  ask user if a /etc/searx/settings.yml file exists.

modified   searx/settings.yml
  Add comments about when it is needed to run 'make buildenv'

modified   searx/settings_defaults.py
  Default for server:port is taken from enviroment variable SEARX_PORT.

modified   utils/build_env.py
  - Some defaults in the settings.yml are taken from the environment,
    e.g. SEARX_BIND_ADDRESS (searx.settings_defaults.SHEMA).  When the
    'brand.env' file is created these enviroment variables should be
    unset first.
  - The CONTACT_URL enviroment is not needed in the utils/brand.env

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-21 14:38:54 +02:00
Markus Heiser
6fbf5180bf [mod] drop obsolete searx.brand namespace
The usages of the searx.brand namespace has been removed, the searx.brand
namespace is now longer needed.

The searx.brand namespace was an interim solution which has been added in commit
9e53470b4, see commit message there ...

    This patch is a first 'proof of concept'.  Later we can decide to remove the
    brand namespace entirely or not.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-21 13:38:28 +02:00
Markus Heiser
3f638ed196 [mod] drop usage of the searx.brand namespace (templates & /config)
In the templates and the /config (JSON) the usage of the 'brand.*' name
space is replaced by 'searx.get_setting' function.

- new_issue_url          --> get_setting('brand.new_issue_url')
- brand.GIT_URL          --> get_setting('brand.git_url')
- brand.PUBLIC_INSTANCES --> get_setting('brand.public_instances')
- brand.DOCS_URL         --> get_setting('brand.docs_url')
- brand.ISSUE_URL        --> get_setting('brand.issue_url')
- brand.CONTACT_URL      --> get_setting('general.contact_url', '')

The macro 'new_issue' from searx/templates/*/messages/no_results.html
is now imported with context::

    {% from '__common__/new_issue.html' import new_issue with context %}

To get *public instances URL* from context's 'get_setting()' function::

    get_setting('brand.public_instances','')

Macro's prototype does no longer need the 'new_issue_url' argument and has been
changed to::

    macro new_issue(engine_name, engine_reliability)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-21 13:38:28 +02:00
Markus Heiser
c9220de690 [mod] drop unused setting option brand:twitter_url
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-21 13:38:28 +02:00
Markus Heiser
2a2b6c4d57 [fix] add missing brand options to the settings SCHEMA
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-21 13:38:28 +02:00
Markus Heiser
3e50e8de3e [mod] drop usage of the searx.brand namespace (python procs)
Added function searx.get_setting(name, default=_unset):
  Returns the value to which ``name`` point.  If there is no such name in the
  settings and the ``default`` is unset, a KeyError exception is raised.

In all the python processes ..

- make docs
- make buildenv
- make install (setup.py)

the usage of the 'brand.*' name space is replaced by 'searx.get_setting'
function.

- brand.SEARX_URL        --> get_setting('server.base_url')
- brand.GIT_URL          --> get_setting('brand.git_url')
- brand.GIT_BRANCH'      --> get_setting('server.base_url')
- brand.ISSUE_URL        --> get_setting('brand.issue_url')
- brand.DOCS_URL         --> get_setting('brand.docs_url')
- brand.PUBLIC_INSTANCES --> get_setting('brand.public_instances')
- brand.CONTACT_URL      --> get_setting('general.contact_url', '')
- brand.WIKI_URL         --> get_setting('brand.wiki_url')
- brand.TWITTER_URL      --> get_setting('brand.twitter_url', '')

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-18 15:55:42 +02:00
Alexandre Flament
f523fd3ea7
Merge pull request #211 from MarcAbonce/onions_v3_fix_searxng
Update onion engines to v3
2021-07-16 17:25:37 +02:00
Alexandre Flament
d47b8e36cf
Merge pull request #207 from return42/mongodb
[enh] add mongodb offline engine
2021-07-16 16:15:01 +02:00
Alexandre Flament
0d65a81b1c [mod] qwant engine: fix typos / minor change
minor modification of commit 628b5703f3
(no functionnal change)
2021-07-16 15:32:12 +02:00
Marc Abonce Seguin
1b05ea6a6b update onion engines to v3
remove not_evil which has been down for a while now:
https://old.reddit.com/r/onions/search/?q=not+evil&restrict_sr=on&t=year
2021-07-16 01:36:34 -07:00
Markus Heiser
0a9cd08bf1 [enh] add mongodb offline engine
Cherry-Pick: https://github.com/searx/searx/commit/198aad43
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-15 21:35:33 +02:00