on master help sign in
Merge branch 'master' into gigablast
commit8d318ee1425b55d71b219d46d46860defa9e832b authorMarkus Heiser <markus.heiser@darmarIT.de> dateMon 29 Jun 2020, 16:09 (6 years ago) parent5fac6cf4604012
20 files changed+578−128
README.rst+53−43 docs/admin/installation-uwsgi.rst+6−5 docs/blog/index.rst+1 docs/blog/lxcdev-202006.rst+413 docs/blog/private-engines.rst+1−1 docs/dev/search_api.rst+2−2 docs/user/own-instance.rst+2−2 docs/utils/lxc.sh.rst+4−3 searx/engines/duckduckgo.py+6 searx/engines/yacy.py+1−1 searx/templates/__common__/about.html+9−5 searx/templates/oscar/base.html+2−2 searx/templates/oscar/macros.html+13−13 searx/templates/oscar/result_templates/code.html+2−2 searx/templates/oscar/result_templates/default.html+5−5 searx/templates/oscar/result_templates/images.html+2−2 searx/templates/oscar/result_templates/map.html+4−4 searx/templates/oscar/result_templates/torrent.html+4−4 searx/templates/oscar/result_templates/videos.html+6−6 utils/searx.sh+42−28
README.rst+53−43
@@ -1,63 +1,73 @@
1−searx
2−=====
1+.. SPDX-License-Identifier: AGPL-3.0-or-later
2+
3+.. figure:: https://raw.githubusercontent.com/asciimoo/searx/master/searx/static/themes/oscar/img/logo_searx_a.png
4+ :target: https://asciimoo.github.io/searx/
5+ :alt: searX
6+ :width: 100%
7+ :align: center
8+
9+-------
10+
11+|searx install|
12+|searx homepage|
13+|searx wiki|
14+|AGPL License|
15+|Issues|
16+|commits|
17+|OpenCollective searx backers|
18+|OpenCollective searx sponsors|
319
4−A privacy-respecting, hackable `metasearch
5−engine <https://en.wikipedia.org/wiki/Metasearch_engine>`__.
20+Privacy-respecting, hackable `metasearch engine`_ / *pronunciation* **səːks**.
621
7−Pronunciation: səːks
22+.. _metasearch engine: https://en.wikipedia.org/wiki/Metasearch_engine
823
9−List of `running
10−instances <https://searx.space/>`__.
24+.. |searx install| image:: https://img.shields.io/badge/-install-blue
25+ :target: https://asciimoo.github.io/searx/admin/installation.html
1126
12−See the `documentation <https://asciimoo.github.io/searx>`__ and the `wiki <https://github.com/asciimoo/searx/wiki>`__ for more information.
27+.. |searx homepage| image:: https://img.shields.io/badge/-homepage-blue
28+ :target: https://asciimoo.github.io/searx
1329
14−|OpenCollective searx backers|
15−|OpenCollective searx sponsors|
30+.. |searx wiki| image:: https://img.shields.io/badge/-wiki-blue
31+ :target: https://github.com/asciimoo/searx/wiki
1632
17−Installation
18−~~~~~~~~~~~~
33+.. |AGPL License| image:: https://img.shields.io/badge/license-AGPL-blue.svg
34+ :target: https://github.com/asciimoo/searx/blob/master/LICENSE
1935
20−With Docker
21−-----------
22−Go to the `searx-docker <https://github.com/searx/searx-docker>`__ project.
36+.. |Issues| image:: https://img.shields.io/github/issues/asciimoo/searx?color=yellow&label=issues
37+ :target: https://github.com/asciimoo/searx/issues
2338
24−Without Docker
25−--------------
26−For all of the details, follow this `step by step installation <https://asciimoo.github.io/searx/admin/installation.html>`__.
39+.. |PR| image:: https://img.shields.io/github/issues-pr-raw/asciimoo/searx?color=yellow&label=PR
40+ :target: https://github.com/asciimoo/searx/pulls
2741
28−Note: the documentation needs to be updated.
42+.. |commits| image:: https://img.shields.io/github/commit-activity/y/asciimoo/searx?color=yellow&label=commits
43+ :target: https://github.com/asciimoo/searx/commits/master
2944
30−If you are in a hurry
31−---------------------
32−- clone the source:
33− ``git clone https://github.com/asciimoo/searx.git && cd searx``
34−- install dependencies: ``./manage.sh update_packages``
35−- edit your
36− `settings.yml <https://github.com/asciimoo/searx/blob/master/searx/settings.yml>`__
37− (set your ``secret_key``!)
38−- run ``python searx/webapp.py`` to start the application
45+.. |OpenCollective searx backers| image:: https://opencollective.com/searx/backers/badge.svg
46+ :target: https://opencollective.com/searx#backer
3947
48+.. |OpenCollective searx sponsors| image:: https://opencollective.com/searx/sponsors/badge.svg
49+ :target: https://opencollective.com/searx#sponsor
4050
41−Bugs
42−~~~~
4351
44−Bugs or suggestions? Visit the `issue
45−tracker <https://github.com/asciimoo/searx/issues>`__.
52+If you are looking for running instances, ready to use, then visit searx.space_.
4653
47−`License <https://github.com/asciimoo/searx/blob/master/LICENSE>`__
48−~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54+Otherwise jump to the user_, admin_ and developer_ handbooks you will find on
55+our homepage_.
4956
50−More about searx
51−~~~~~~~~~~~~~~~~
57+.. _searx.space: https://searx.space
58+.. _user: https://asciimoo.github.io/searx/user
59+.. _admin: https://asciimoo.github.io/searx/admin
60+.. _developer: https://asciimoo.github.io/searx/dev
61+.. _homepage: https://asciimoo.github.io/searx
5262
53−- `openhub <https://www.openhub.net/p/searx/>`__
54−- `twitter <https://twitter.com/Searx_engine>`__
55−- IRC: #searx @ freenode
63+contact:
64+ openhub_ // twitter_ // IRC: #searx @ freenode
5665
66+.. _openhub: https://www.openhub.net/p/searx
67+.. _twitter: https://twitter.com/Searx_engine
5768
58−.. |OpenCollective searx backers| image:: https://opencollective.com/searx/backers/badge.svg
59− :target: https://opencollective.com/searx#backer
69+-------
6070
71+|gluten free|
6172
62−.. |OpenCollective searx sponsors| image:: https://opencollective.com/searx/sponsors/badge.svg
63− :target: https://opencollective.com/searx#sponsor
73+.. |gluten free| image:: https://forthebadge.com/images/featured/featured-gluten-free.svg
docs/admin/installation-uwsgi.rst+6−5
@@ -108,6 +108,7 @@ restart the uwsgi application.
108108 :start-after: START searx uwsgi-description ubuntu-20.04
109109 :end-before: END searx uwsgi-description ubuntu-20.04
110110
111+ .. hotfix: a bug group-tab need this comment
111112
112113 .. group-tab:: Arch Linux
113114
@@ -115,6 +116,7 @@ restart the uwsgi application.
115116 :start-after: START searx uwsgi-description arch
116117 :end-before: END searx uwsgi-description arch
117118
119+ .. hotfix: a bug group-tab need this comment
118120
119121 .. group-tab:: Fedora / RHEL
120122
@@ -128,22 +130,21 @@ restart the uwsgi application.
128130 .. group-tab:: Ubuntu / debian
129131
130132 .. kernel-include:: $DOCS_BUILD/includes/searx.rst
131− :code: ini
132133 :start-after: START searx uwsgi-appini ubuntu-20.04
133134 :end-before: END searx uwsgi-appini ubuntu-20.04
134135
136+ .. hotfix: a bug group-tab need this comment
137+
135138 .. group-tab:: Arch Linux
136139
137140 .. kernel-include:: $DOCS_BUILD/includes/searx.rst
138− :code: ini
139141 :start-after: START searx uwsgi-appini arch
140142 :end-before: END searx uwsgi-appini arch
141143
144+ .. hotfix: a bug group-tab need this comment
145+
142146 .. group-tab:: Fedora / RHEL
143147
144148 .. kernel-include:: $DOCS_BUILD/includes/searx.rst
145− :code: ini
146149 :start-after: START searx uwsgi-appini fedora
147150 :end-before: END searx uwsgi-appini fedora
148−
149−
docs/blog/index.rst+1
@@ -6,6 +6,7 @@ Blog
66 :maxdepth: 2
77 :caption: Contents
88
9+ lxcdev-202006
910 python3
1011 admin
1112 intro-offline
docs/blog/lxcdev-202006.rstnew file+413
@@ -0,0 +1,413 @@
1+.. _blog-lxcdev-202006:
2+
3+=======================================
4+Developing in Linux containers [202006]
5+=======================================
6+
7+.. _LXC: https://linuxcontainers.org/lxc/introduction/
8+
9+.. sidebar:: Audience
10+
11+ This blog post is written for experienced admins and developers / readers
12+ should have a serious meaning about: *distributed*, *merge* and *linux
13+ container*.
14+
15+.. contents:: Contents
16+ :depth: 2
17+ :local:
18+ :backlinks: entry
19+
20+In PR :PR:`1803` we added a lot of scripts to Searx's boilerplate. In this blog
21+post I will show you, how you can make use of them in *distributed and
22+heterogeneous development cycles* (TL;DR; jump to the :ref:`blog-lxcdev-202006
23+abstract`).
24+
25+Motivation
26+==========
27+
28+Normally in our development cycle, we edit the sources and run some test and/or
29+builds by using ``make`` before we commit. This cycle is simple and perfect but
30+might fail in some aspects we should not overlook.
31+
32+ The environment in which we run all our development processes matters!
33+
34+The :ref:`makefile` and the :ref:`make pyenv` encapsulate a lot for us, but they
35+do not have access to all prerequisites. For example, there may have
36+dependencies on packages that are installed on the developer's desktop, but
37+usually are not preinstalled on a server or client system. Another examples
38+are; settings have been made to the software on the developer's host that would
39+never be set on a *production* system.
40+
41+*Linux Containers* (LXC_) are isolate environments and not to mix up on
42+developer's all the prerequisites of all the projects he contribute to, is
43+always a good choice.
44+
45+The scripts from PR :PR:`1803` can divide in those to install and maintain
46+software:
47+
48+- :ref:`searx.sh`
49+- :ref:`filtron.sh`
50+- :ref:`morty.sh`
51+
52+and the script :ref:`lxc.sh`, with we can scale our installation, maintenance or
53+even development tasks over a stack of containers, what we call: *Searx's lxc
54+suite*.
55+
56+Gentlemen, start your engines!
57+==============================
58+
59+.. _LXD: https://linuxcontainers.org/lxd/introduction/
60+.. _archlinux: https://www.archlinux.org/
61+
62+Before you can start with containers, you need to install and initiate LXD_
63+once:
64+
65+.. tabs::
66+
67+ .. group-tab:: desktop
68+
69+ .. code:: sh
70+
71+ $ snap install lxd
72+ $ lxd init --auto
73+
74+And you need to clone from origin or if you have your own fork, clone from your
75+fork:
76+
77+.. tabs::
78+
79+ .. group-tab:: desktop
80+
81+ .. code:: sh
82+
83+ $ cd ~/Downloads
84+ $ git clone https://github.com/asciimoo/searx.git
85+ $ cd searx
86+
87+The :ref:`lxc-searx.env` consists of several images, see ``export
88+LXC_SUITE=(...`` near by :origin:`utils/lxc-searx.env#L19`. For this blog post
89+we exercise on a archlinux_ image. The container of this image is named
90+``searx-archlinux``. Lets build the container, but be sure that this container
91+does not already exists, so first lets remove possible old one:
92+
93+.. tabs::
94+
95+ .. group-tab:: desktop
96+
97+ .. code:: sh
98+
99+ $ sudo -H ./utils/lxc.sh remove searx-archlinux
100+ $ sudo -H ./utils/lxc.sh build searx-archlinux
101+
102+.. sidebar:: The ``searx-archlinux`` container
103+
104+ is the base of all our exercises here.
105+
106+In this container we install all services :ref:`including searx, morty & filtron
107+<lxc.sh install suite>` in once:
108+
109+.. tabs::
110+
111+ .. group-tab:: desktop
112+
113+ .. code:: sh
114+
115+ $ sudo -H ./utils/lxc.sh install suite searx-archlinux
116+
117+To proxy HTTP from filtron and morty in the container to the outside of the
118+container, install nginx into the container. Once for the bot blocker filtron:
119+
120+.. tabs::
121+
122+ .. group-tab:: desktop
123+
124+ .. code:: sh
125+
126+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
127+ ./utils/filtron.sh nginx install
128+ ...
129+ INFO: got 429 from http://10.174.184.156/searx
130+
131+and once for the content sanitizer (content proxy morty):
132+
133+.. tabs::
134+
135+ .. group-tab:: desktop
136+
137+ .. code:: sh
138+
139+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
140+ ./utils/morty.sh nginx install
141+ ...
142+ INFO: got 200 from http://10.174.184.156/morty/
143+
144+.. sidebar:: Fully functional searx suite
145+
146+ From here on you have a fully functional searx suite running with bot blocker
147+ (filtron) and Web content sanitizer (content proxy morty) needed for a
148+ *privacy protecting* search engine.
149+
150+On your system, the IP of your ``searx-archlinux`` container differs from
151+http://10.174.184.156/searx, just open the URL reported in your installation
152+protocol in your WEB browser from the desktop to test the instance from outside
153+of the container.
154+
155+In such a searx suite admins can maintain and access the debug log of the
156+different services quite easy.
157+
158+.. _working in containers:
159+
160+In containers, work as usual
161+============================
162+
163+Usually you open a root-bash using ``sudo -H bash``. In case of LXC containers
164+open the root-bash in the container using ``./utils/lxc.sh cmd
165+searx-archlinux``:
166+
167+.. tabs::
168+
169+ .. group-tab:: desktop
170+
171+ .. code:: sh
172+
173+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux bash
174+ INFO: [searx-archlinux] bash
175+ [root@searx-archlinux searx]# pwd
176+ /share/searx
177+
178+The prompt ``[root@searx-archlinux ...]`` signals, that you are the root user in
179+the searx-container. To debug the running searx instance use:
180+
181+.. tabs::
182+
183+ .. group-tab:: root@searx-archlinux
184+
185+ .. code:: sh
186+
187+ $ ./utils/searx.sh inspect service
188+ ...
189+ use [CTRL-C] to stop monitoring the log
190+ ...
191+
192+Back in the browser on your desktop open the service http://10.174.184.156/searx
193+and run your application tests while the debug log is shown in the terminal from
194+above. You can stop monitoring using ``CTRL-C``, this also disables the *"debug
195+option"* in searx's settings file and restarts the searx uwsgi application. To
196+debug services from filtron and morty analogous use:
197+
198+.. tabs::
199+
200+ .. group-tab:: root@searx-archlinux
201+
202+ .. code:: sh
203+
204+ $ ./utils/filtron.sh inspect service
205+ $ ./utils/morty.sh inspect service
206+
207+Another point we have to notice is that each service (:ref:`searx <searx.sh>`,
208+:ref:`filtron <filtron.sh>` and :ref:`morty <morty.sh>`) runs under dedicated
209+system user account with the same name (compare :ref:`create searx user`). To
210+get a shell from theses accounts, simply call one of the scripts:
211+
212+.. tabs::
213+
214+ .. group-tab:: root@searx-archlinux
215+
216+ .. code:: sh
217+
218+ $ ./utils/searx.sh shell
219+ $ ./utils/filtron.sh shell
220+ $ ./utils/morty.sh shell
221+
222+To get in touch, open a shell from the service user (searx@searx-archlinux):
223+
224+.. tabs::
225+
226+ .. group-tab:: desktop
227+
228+ .. code:: sh
229+
230+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
231+ ./utils/searx.sh shell
232+ // exit with [CTRL-D]
233+ (searx-pyenv) [searx@searx-archlinux ~]$ ...
234+
235+The prompt ``[searx@searx-archlinux]`` signals that you are logged in as system
236+user ``searx`` in the ``searx-archlinux`` container and the python *virtualenv*
237+``(searx-pyenv)`` environment is activated.
238+
239+.. tabs::
240+
241+ .. group-tab:: searx@searx-archlinux
242+
243+ .. code:: sh
244+
245+ (searx-pyenv) [searx@searx-archlinux ~]$ pwd
246+ /usr/local/searx
247+
248+
249+
250+Wrap production into developer suite
251+====================================
252+
253+In this section we will see how to change the *"Fully functional searx suite"*
254+from a LXC container (which is quite ready for production) into a developer
255+suite. For this, we have to keep an eye on the :ref:`installation basic`:
256+
257+- searx setup in: ``/etc/searx/settings.yml``
258+- searx user's home: ``/usr/local/searx``
259+- virtualenv in: ``/usr/local/searx/searx-pyenv``
260+- searx software in: ``/usr/local/searx/searx-src``
261+
262+The searx software is a clone of the ``GIT_URL`` (see :ref:`makefile setup`) and
263+the working tree is checked out from the ``GIT_BRANCH``. With the use of the
264+:ref:`searx.sh` the searx service was installed as :ref:`uWSGI application
265+<searx uwsgi>`. To maintain this service, we can use ``systemctl`` (compare
266+:ref:`service architectures on distributions <uwsgi configuration>`).
267+
268+.. tabs::
269+
270+ .. group-tab:: desktop
271+
272+ .. code:: sh
273+
274+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
275+ systemctl stop uwsgi@searx
276+
277+With the command above, we stopped the searx uWSGI-App in the archlinux
278+container.
279+
280+The uWSGI-App for the archlinux dsitros is configured in
281+:origin:`utils/templates/etc/uwsgi/apps-archlinux/searx.ini`, from where at
282+least you should attend the settings of ``uid``, ``chdir``, ``env`` and
283+``http``::
284+
285+ env = SEARX_SETTINGS_PATH=/etc/searx/settings.yml
286+ http = 127.0.0.1:8888
287+
288+ chdir = /usr/local/searx/searx-src/searx
289+ virtualenv = /usr/local/searx/searx-pyenv
290+ pythonpath = /usr/local/searx/searx-src
291+
292+If you have read the :ref:`"Good to know section" <lxc.sh>` you remember, that
293+each container shares the root folder of the repository and the command
294+``utils/lxc.sh cmd`` handles relative path names **transparent**. To wrap the
295+searx installation into a developer one, we simple have to create a smylink to
296+the **transparent** reposetory from the desktop. Now lets replace the
297+repository at ``searx-src`` in the container with the working tree from outside
298+of the container:
299+
300+.. tabs::
301+
302+ .. group-tab:: container becomes a developer suite
303+
304+ .. code:: sh
305+
306+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
307+ mv /usr/local/searx/searx-src /usr/local/searx/searx-src.old
308+
309+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
310+ ln -s /share/searx/ /usr/local/searx/searx-src
311+
312+Now we can develop as usual in the working tree of our desktop system. Every
313+time the software was changed, you have to restart the searx service (in the
314+conatiner):
315+
316+.. tabs::
317+
318+ .. group-tab:: desktop
319+
320+ .. code:: sh
321+
322+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
323+ systemctl restart uwsgi@searx
324+
325+
326+Remember: :ref:`working in containers` .. here are just some examples from my
327+daily usage:
328+
329+.. tabs::
330+
331+ .. group-tab:: desktop
332+
333+ To *inspect* the searx instance (already described above):
334+
335+ .. code:: sh
336+
337+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
338+ ./utils/searx.sh inspect service
339+
340+ Run :ref:`makefile`, e.g. to test inside the container:
341+
342+ .. code:: sh
343+
344+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
345+ make test
346+
347+ To install all prerequisites needed for a :ref:`buildhosts`:
348+
349+ .. code:: sh
350+
351+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
352+ ./utils/searx.sh install buildhost
353+
354+ To build the docs on a buildhost :ref:`buildhosts`:
355+
356+ .. code:: sh
357+
358+ $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
359+ make docs
360+
361+.. _blog-lxcdev-202006 abstract:
362+
363+Abstract
364+========
365+
366+We build up a fully functional searx suite in a archlinux container:
367+
368+.. code:: sh
369+
370+ $ sudo -H ./utils/lxc.sh install suite searx-archlinux
371+
372+To access HTTP from the desktop we installed nginx for the services inside the
373+conatiner:
374+
375+.. tabs::
376+
377+ .. group-tab:: [root@searx-archlinux]
378+
379+ .. code:: sh
380+
381+ $ ./utils/filtron.sh nginx install
382+ $ ./utils/morty.sh nginx install
383+
384+To wrap the suite into a developer one, we created a symbolic link to the
385+repository which is shared **transparent** from the desktop's file system into
386+the container :
387+
388+.. tabs::
389+
390+ .. group-tab:: [root@searx-archlinux]
391+
392+ .. code:: sh
393+
394+ $ mv /usr/local/searx/searx-src /usr/local/searx/searx-src.old
395+ $ ln -s /share/searx/ /usr/local/searx/searx-src
396+ $ systemctl restart uwsgi@searx
397+
398+To get remarks from the suite of the archlinux container we can use:
399+
400+.. tabs::
401+
402+ .. group-tab:: desktop
403+
404+ .. code:: sh
405+
406+ $ sudo -H ./utils/lxc.sh show suite searx-archlinux
407+ ...
408+ [searx-archlinux] INFO: (eth0) filtron: http://10.174.184.156:4004/ http://10.174.184.156/searx
409+ [searx-archlinux] INFO: (eth0) morty: http://10.174.184.156:3000/
410+ [searx-archlinux] INFO: (eth0) docs-live: http://10.174.184.156:8080/
411+ [searx-archlinux] INFO: (eth0) IPv6: http://[fd42:573b:e0b3:e97e:216:3eff:fea5:9b65]
412+ ...
413+
docs/blog/private-engines.rst+1−1
@@ -13,7 +13,7 @@ Private engines
1313To solve this issue private engines were introduced in :pull:`1823`.
1414A new option was added to engines named `tokens`. It expects a list
1515of strings. If the user making a request presents one of the tokens
16−of an engine, he/she is able to access information about the engine
16+of an engine, they can access information about the engine
1717and make search requests.
1818
1919Example configuration to restrict access to the Arch Linux Wiki engine:
docs/dev/search_api.rst+2−2
@@ -81,7 +81,7 @@ Parameters
8181 Theme of instance.
8282
8383 Please note, available themes depend on an instance. It is possible that an
84− instance administrator deleted, created or renamed themes on his/her instance.
84+ instance administrator deleted, created or renamed themes on their instance.
8585 See the available options in the preferences page of the instance.
8686
8787``oscar-style`` : default ``logicodev``
@@ -91,7 +91,7 @@ Parameters
9191 ``oscar``.
9292
9393 Please note, available styles depend on an instance. It is possible that an
94− instance administrator deleted, created or renamed styles on his/her
94+ instance administrator deleted, created or renamed styles on their
9595 instance. See the available options in the preferences page of the instance.
9696
9797``enabled_plugins`` : optional
docs/user/own-instance.rst+2−2
@@ -44,9 +44,9 @@ hidden from visited result pages.
4444What are the consequences of using public instances?
4545----------------------------------------------------
4646
47−If someone uses a public instance, he/she has to trust the administrator of that
47+If someone uses a public instance, they have to trust the administrator of that
4848instance. This means that the user of the public instance does not know whether
49−his/her requests are logged, aggregated and sent or sold to a third party.
49+their requests are logged, aggregated and sent or sold to a third party.
5050
5151Also, public instances without proper protection are more vulnerable to abusing
5252the search service, In this case the external service in exchange returns
docs/utils/lxc.sh.rst+4−3
@@ -47,9 +47,9 @@ one**::
4747
4848*Good to know ...*
4949
50−Eeach container shares the root folder of the repository and the
51−command ``utils/lxc.sh cmd`` **handles relative path names transparent**,
52−compare output of::
50+Each container shares the root folder of the repository and the command
51+``utils/lxc.sh cmd`` **handles relative path names transparent**, compare output
52+of::
5353
5454 $ sudo -H ./utils/lxc.sh cmd -- ls -la Makefile
5555 ...
@@ -66,6 +66,7 @@ If there comes the time you want to **get rid off all** the containers and
6666 $ sudo -H ./utils/lxc.sh remove
6767 $ sudo -H ./utils/lxc.sh remove images
6868
69+.. _lxc.sh install suite:
6970
7071Install suite
7172=============
searx/engines/duckduckgo.py+6
@@ -50,6 +50,7 @@ result_xpath = '//div[@class="result results_links results_links_deep web-result
5050url_xpath = './/a[@class="result__a"]/@href'
5151title_xpath = './/a[@class="result__a"]'
5252content_xpath = './/a[@class="result__snippet"]'
53+correction_xpath = '//div[@id="did_you_mean"]//a'
5354
5455
5556# match query's language to a region code that duckduckgo will accept
@@ -125,6 +126,11 @@ def response(resp):
125126 'content': content,
126127 'url': res_url})
127128
129+ # parse correction
130+ for correction in eval_xpath(doc, correction_xpath):
131+ # append correction
132+ results.append({'correction': extract_text(correction)})
133+
128134 # return results
129135 return results
130136
searx/engines/yacy.py+1−1
@@ -75,7 +75,7 @@ def response(resp):
7575
7676 for result in search_results[0].get('items', []):
7777 # parse image results
78− if result.get('image'):
78+ if result.get('image') and result.get('width') and result.get('height'):
7979
8080 result_url = ''
8181 if 'url' in result:
searx/templates/__common__/about.html+9−5
@@ -59,12 +59,16 @@
5959
6060 <h2 id='add to browser'>How to set as the default search engine?</h2>
6161
62− <dt>Firefox</dt>
62+ <p>
63+ Searx supports <a href="https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md">OpenSearch</a>.
64+ For more information on changing your default search engine, see your browser's documentation:
65+ </p>
6366
64− <dd>
65− <a href="#" onclick="window.external.AddSearchProvider(window.location.protocol + '//' + window.location.host + '{{ url_for('opensearch') }}');">Install</a>
66− searx as a search engine on any version of Firefox! (javascript required)
67− </dd>
67+ <ul>
68+ <li><a href="https://support.mozilla.org/en-US/kb/add-or-remove-search-engine-firefox">Firefox</a></li>
69+ <li><a href="https://support.microsoft.com/en-us/help/4028574/microsoft-edge-change-the-default-search-engine" >Microsoft Egde</a></li>
70+ <li>Chrome based browsers <a href="https://www.chromium.org/tab-to-search">only add websites that the user navigates to without a path.</a>
71+ </ul>
6872
6973 <h2>Where to find anonymous usage statistics of this instance ?</h2>
7074
searx/templates/oscar/base.html+2−2
@@ -8,7 +8,7 @@
88 <meta http-equiv="X-UA-Compatible" content="IE=edge">
99 <meta name="generator" content="searx/{{ searx_version }}">
1010 <meta name="referrer" content="no-referrer">
11− <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" />
11+ <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=2.0, user-scalable=1" />
1212 {% block meta %}{% endblock %}
1313 <script src="{{ url_for('js_translations') }}"></script>
1414 <title>{% block title %}{% endblock %}{{ instance_name }}</title>
@@ -42,7 +42,7 @@
4242 <style type="text/css">
4343 .tab-content > .active_if_nojs, .active_if_nojs {display: block !important; visibility: visible !important;}
4444 .margin_top_if_nojs {margin-top: 20px;}
45− .hide_if_nojs {display: none !important;overflow:none !important;}
45+ .hide_if_nojs {display: none !important;overflow: hidden !important;}
4646 .disabled_if_nojs {pointer-events: none; cursor: default; text-decoration: line-through;}
4747 </style>
4848 </noscript>
searx/templates/oscar/macros.html+13−13
@@ -8,34 +8,34 @@
88 <img width="32" height="32" class="favicon" src="{{ url_for('static', filename='themes/oscar/img/icons/' + favicon + '.png') }}" alt="{{ favicon }}" />
99{%- endmacro %}
1010
11−{%- macro result_link(url, title, classes='') -%}
12−<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ title }}</a>
11+{%- macro result_link(url, title, classes='', id='') -%}
12+<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}{% if id %} aria-labelledby="result-{{id}}"{%endif%}>{{ title }}</a>
1313{%- endmacro -%}
1414
1515<!-- Draw result header -->
16−{% macro result_header(result, favicons) -%}
17−<h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe) }}{% else %}{{ result.title|safe}}{% endif %}</h4>
16+{% macro result_header(result, favicons, id) -%}
17+<h4 class="result_header" id="result-{{id}}">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe, id=id) }}{% else %}{{ result.title|safe}}{% endif %}</h4>
1818{%- endmacro %}
1919
2020<!-- Draw result sub header -->
21−{% macro result_sub_header(result) -%}
21+{% macro result_sub_header(result, id) -%}
2222 {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
23− {% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}</small>{% endif %}
24− {% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}</small>{% endif %}
23+ {% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink", id) }}</small>{% endif %}
24+ {% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile", id) }}</small>{% endif %}
2525{%- endmacro %}
2626
2727<!-- Draw result footer -->
28−{% macro result_footer(result) -%}
28+{% macro result_footer(result, id) -%}
2929 <div class="clearfix"></div>{{- "" -}}
3030 <div class="pull-right">
3131 {%- for engine in result.engines -%}
3232 <span class="label label-default">{{ engine }}</span>
3333 {%- endfor -%}
3434 {%- if result.url -%}
35− <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
35+ <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small>
3636 {%- endif -%}
3737 {%- if proxify -%}
38− <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
38+ <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }}</small>
3939 {%- endif -%}
4040 </div>
4141 {%- if result.pretty_url -%}
@@ -44,16 +44,16 @@
4444{%- endmacro %}
4545
4646<!-- Draw result footer -->
47−{% macro result_footer_rtl(result) -%}
47+{% macro result_footer_rtl(result, id) -%}
4848 <div class="clearfix"></div>{{- "" -}}
4949 {% for engine in result.engines -%}
5050 <span class="label label-default">{{ engine }}</span>
5151 {%- endfor %}
5252 {%- if result.url -%}
53− <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
53+ <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small>
5454 {%- endif -%}
5555 {% if proxify -%}
56− <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
56+ <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }}</small>
5757 {%- endif %}
5858 {%- if result.pretty_url -%}
5959 <div class="external-link">{{ result.pretty_url }}</div>
searx/templates/oscar/result_templates/code.html+2−2
@@ -1,11 +1,11 @@
1−{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
1+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context%}
22
33{{ result_header(result, favicons) }}
44{{ result_sub_header(result) }}
55
66{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
77
8−{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a></p>{% endif %}
8+{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} aria-labelledby="result-{{loop.index}}">{{ result.repository }}</a></p>{% endif %}
99
1010<div dir="ltr">
1111{{ result.codelines|code_highlighter(result.code_language)|safe }}
searx/templates/oscar/result_templates/default.html+5−5
@@ -1,10 +1,10 @@
11{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context %}
22
3−{{- result_header(result, favicons) -}}
4−{{- result_sub_header(result) -}}
3+{{- result_header(result, favicons, loop.index) -}}
4+{{- result_sub_header(result, loop.index) -}}
55
66{%- if result.embedded -%}
7− <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
7+ <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}" aria-labelledby="result-{{loop.index}}">{{ icon('music') }} {{ _('show media') }}</a></small>
88{%- endif -%}
99
1010{%- if result.embedded -%}
@@ -25,7 +25,7 @@
2525{%- endif -%}
2626
2727{%- if rtl -%}
28−{{ result_footer_rtl(result) }}
28+{{ result_footer_rtl(result, loop.index) }}
2929{%- else -%}
30−{{ result_footer(result) }}
30+{{ result_footer(result, loop.index) }}
3131{%- endif -%}
searx/templates/oscar/result_templates/images.html+2−2
@@ -1,6 +1,6 @@
1−{%- from 'oscar/macros.html' import draw_favicon -%}
1+{%- from 'oscar/macros.html' import draw_favicon with context -%}
22
3−<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}">{{- "" -}}
3+<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}" id="result-{{loop.index}}">{{- "" -}}
44 <img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">{{- "" -}}
55</a>
66<div class="modal fade" id="modal-{{ index }}-{{ pageno }}" tabindex="-1" role="dialog" aria-hidden="true">{{- "" -}}
searx/templates/oscar/result_templates/map.html+4−4
@@ -1,7 +1,7 @@
11{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
22
3−{{ result_header(result, favicons) }}
4−{{ result_sub_header(result) }}
3+{{ result_header(result, favicons, loop.index) }}
4+{{ result_sub_header(result, loop.index) }}
55
66{% if (result.latitude and result.longitude) or result.boundingbox %}
77 <small> &bull; <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></small>
@@ -66,7 +66,7 @@
6666{% endif %}
6767
6868{% if rtl %}
69−{{ result_footer_rtl(result) }}
69+{{ result_footer_rtl(result, loop.index) }}
7070{% else %}
71−{{ result_footer(result) }}
71+{{ result_footer(result, loop.index) }}
7272{% endif %}
searx/templates/oscar/result_templates/torrent.html+4−4
@@ -1,7 +1,7 @@
11{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
22
3−{{ result_header(result, favicons) }}
4−{{ result_sub_header(result) }}
3+{{ result_header(result, favicons, loop.index) }}
4+{{ result_sub_header(result, loop.index) }}
55
66{% if result.seed is defined %}<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> &bull; {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>{% endif %}
77{% if result.filesize %}<br />{{ icon('floppy-disk') }} {{ _('Filesize') }}
@@ -19,7 +19,7 @@
1919</p>
2020
2121{% if rtl %}
22−{{ result_footer_rtl(result) }}
22+{{ result_footer_rtl(result, loop.index) }}
2323{% else %}
24−{{ result_footer(result) }}
24+{{ result_footer(result, loop.index) }}
2525{% endif %}
searx/templates/oscar/result_templates/videos.html+6−6
@@ -1,10 +1,10 @@
11{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
22
3−{{ result_header(result, favicons) }}
4−{{ result_sub_header(result) }}
3+{{ result_header(result, favicons, loop.index) }}
4+{{ result_sub_header(result, loop.index) }}
55
66{% if result.embedded %}
7− <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film') }} {{ _('show video') }}</a></small>
7+ <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}" aria-labelledby="result-{{loop.index}}">{{ icon('film') }} {{ _('show video') }}</a></small>
88{% endif %}
99
1010{% if result.embedded %}
@@ -15,7 +15,7 @@
1515
1616<div class="container-fluid">
1717 <div class="row">
18− <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ image_proxify(result.thumbnail) }}" /></a>
18+ <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ image_proxify(result.thumbnail) }}" aria-labelledby="result-{{loop.index}}" /></a>
1919 {% if result.author %}<p class="col-xs-12 col-sm-8 col-md-8 result-content"><b>{{ _('Author') }}</b>: {{ result.author }}</p>{% endif %}
2020 {% if result.length %}<p class="col-xs-12 col-sm-8 col-md-8 result-content"><b>{{ _('Length') }}</b>: {{ result.length }}</p>{% endif %}
2121 {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
@@ -23,7 +23,7 @@
2323</div>
2424
2525{% if rtl %}
26−{{ result_footer_rtl(result) }}
26+{{ result_footer_rtl(result, loop.index) }}
2727{% else %}
28−{{ result_footer(result) }}
28+{{ result_footer(result, loop.index) }}
2929{% endif %}
utils/searx.sh+42−28
@@ -816,47 +816,61 @@ rst-doc() {
816816
817817 case $DIST_ID-$DIST_VERS in
818818 ubuntu-*|debian-*) cat <<EOF
819−# init.d --> /usr/share/doc/uwsgi/README.Debian.gz
820−# For uWSGI debian uses the LSB init process, this might be changed
821−# one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067
822−
823−create ${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP}
824−enable: sudo -H ln -s ${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP} ${uWSGI_APPS_ENABLED}/
825−start: sudo -H service uwsgi start ${SEARX_UWSGI_APP%.*}
826−restart: sudo -H service uwsgi restart ${SEARX_UWSGI_APP%.*}
827−stop: sudo -H service uwsgi stop ${SEARX_UWSGI_APP%.*}
828−disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
819+
820+.. code:: bash
821+
822+ # init.d --> /usr/share/doc/uwsgi/README.Debian.gz
823+ # For uWSGI debian uses the LSB init process, this might be changed
824+ # one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067
825+
826+ create ${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP}
827+ enable: sudo -H ln -s ${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP} ${uWSGI_APPS_ENABLED}/
828+ start: sudo -H service uwsgi start ${SEARX_UWSGI_APP%.*}
829+ restart: sudo -H service uwsgi restart ${SEARX_UWSGI_APP%.*}
830+ stop: sudo -H service uwsgi stop ${SEARX_UWSGI_APP%.*}
831+ disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
832+
829833EOF
830834 ;;
831835 arch-*) cat <<EOF
832−# systemd --> /usr/lib/systemd/system/uwsgi@.service
833−# For uWSGI archlinux uses systemd template units, see
834−# - http://0pointer.de/blog/projects/instances.html
835−# - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd
836−
837−create: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
838−enable: sudo -H systemctl enable uwsgi@${SEARX_UWSGI_APP%.*}
839−start: sudo -H systemctl start uwsgi@${SEARX_UWSGI_APP%.*}
840−restart: sudo -H systemctl restart uwsgi@${SEARX_UWSGI_APP%.*}
841−stop: sudo -H systemctl stop uwsgi@${SEARX_UWSGI_APP%.*}
842−disable: sudo -H systemctl disable uwsgi@${SEARX_UWSGI_APP%.*}
836+
837+.. code:: bash
838+
839+ # systemd --> /usr/lib/systemd/system/uwsgi@.service
840+ # For uWSGI archlinux uses systemd template units, see
841+ # - http://0pointer.de/blog/projects/instances.html
842+ # - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd
843+
844+ create: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
845+ enable: sudo -H systemctl enable uwsgi@${SEARX_UWSGI_APP%.*}
846+ start: sudo -H systemctl start uwsgi@${SEARX_UWSGI_APP%.*}
847+ restart: sudo -H systemctl restart uwsgi@${SEARX_UWSGI_APP%.*}
848+ stop: sudo -H systemctl stop uwsgi@${SEARX_UWSGI_APP%.*}
849+ disable: sudo -H systemctl disable uwsgi@${SEARX_UWSGI_APP%.*}
850+
843851EOF
844852 ;;
845853 fedora-*) cat <<EOF
846−# systemd --> /usr/lib/systemd/system/uwsgi.service
847−# The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
848−# - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
849854
850−create: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
851−restart: sudo -H touch ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
852−disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
855+.. code:: bash
856+
857+ # systemd --> /usr/lib/systemd/system/uwsgi.service
858+ # The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
859+ # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
860+
861+ create: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
862+ restart: sudo -H touch ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
863+ disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
864+
853865EOF
854866 ;;
855867 esac
856868 echo -e ".. END searx uwsgi-description $DIST_NAME"
857869
858870 echo -e "\n.. START searx uwsgi-appini $DIST_NAME"
859− eval "echo \"$(< "${TEMPLATES}/${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP}")\""
871+ echo ".. code:: bash"
872+ echo
873+ eval "echo \"$(< "${TEMPLATES}/${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP}")\"" | prefix_stdout " "
860874 echo -e "\n.. END searx uwsgi-appini $DIST_NAME"
861875
862876 )