diff --git a/.gitignore b/.gitignore index 828856f4c..069dfd35b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,8 @@ node_modules/ .tx/ +build/ +dist/ local/ +gh-pages/ searx.egg-info/ diff --git a/Makefile b/Makefile index 77ffe489f..f35b86c41 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,32 @@ # -*- coding: utf-8; mode: makefile-gmake -*- +export GIT_URL=https://github.com/asciimoo/searx +export SEARX_URL=https://searx.me +export DOCS_URL=https://asciimoo.github.io/searx + PYOBJECTS = searx +DOC = docs PY_SETUP_EXTRAS ?= \[test\] +PYDIST=./dist/py +PYBUILD=./build/py + include utils/makefile.include include utils/makefile.python +include utils/makefile.sphinx all: clean install PHONY += help help: @echo ' test - run developer tests' + @echo ' docs - build documentation' + @echo ' docs-live - autobuild HTML documentation while editing' @echo ' run - run developer instance' @echo ' install - developer install (./local)' @echo ' uninstall - uninstall (./local)' + @echo ' gh-pages - build docs & deploy on gh-pages branch' + @echo ' clean - drop builds and environments' @echo '' @$(MAKE) -s -f utils/makefile.include make-help @echo '' @@ -40,6 +53,20 @@ run: pyenvinstall ) & $(PY_ENV)/bin/python ./searx/webapp.py +# docs +# ---- + +PHONY += docs +docs: pyenvinstall sphinx-doc + $(call cmd,sphinx,html,docs,docs) + +PHONY += docs-live +docs-live: pyenvinstall sphinx-live + $(call cmd,sphinx_autobuild,html,docs,docs) + +$(GH_PAGES):: + @echo "doc available at --> $(DOCS_URL)" + # test # ---- diff --git a/README.rst b/README.rst index ab16a8280..7fcda4f97 100644 --- a/README.rst +++ b/README.rst @@ -23,13 +23,13 @@ Go to the `searx-docker `__ project. Without Docker ------ -For all the details, follow this `step by step installation `__. +For all of the details, follow this `step by step installation `__. Note: the documentation needs to be updated. -If you are in hurry +If you are in a hurry ------ -- clone source: +- clone the source: ``git clone https://github.com/asciimoo/searx.git && cd searx`` - install dependencies: ``./manage.sh update_packages`` - edit your diff --git a/docs/_themes/searx/static/searx.css b/docs/_themes/searx/static/searx.css new file mode 100644 index 000000000..d6a664f0f --- /dev/null +++ b/docs/_themes/searx/static/searx.css @@ -0,0 +1,130 @@ +@import url("pocoo.css"); + +a, a.reference, a.footnote-reference { + color: #004b6b; + border-color: #004b6b; +} + +a:hover { + color: #6d4100; + border-color: #6d4100; +} + +p.version-warning { + background-color: #004b6b; +} + +div.sidebar { + background-color: whitesmoke; + border-color: lightsteelblue; + border-radius: 3pt; +} + +p.sidebar-title, .sidebar p { + margin: 6pt; +} + +.sidebar li, +.hlist li { + list-style-type: disclosure-closed; +} + + +/* admonitions +*/ + +div.admonition, div.topic { + background-color: #fafafa; + margin: 8px 0px; + padding: 1em; + border-radius: 3pt 0 0 3pt; + border-top: none; + border-right: none; + border-bottom: none; + border-left: 5pt solid #ccc; +} + +p.admonition-title:after { + content: none; +} + +.admonition.hint { border-color: #416dc0b0; } +.admonition.note { border-color: #6c856cb0; } +.admonition.tip { border-color: #85c5c2b0; } +.admonition.attention { border-color: #ecec97b0; } +.admonition.caution { border-color: #a6c677b0; } +.admonition.danger { border-color: #d46262b0; } +.admonition.important { border-color: #dfa3a3b0; } +.admonition.error { border-color: red; } +.admonition.warning { border-color: darkred; } + +.admonition.admonition-generic-admonition-title { + border-color: #416dc0b0; +} + + +/* admonitions with (rendered) reST markup examples (:class: rst-example) + * + * .. admonition:: title of the example + * :class: rst-example + * .... +*/ + +div.rst-example { + background-color: inherit; + margin: 0; + border-top: none; + border-right: 1px solid #ccc; + border-bottom: none; + border-left: none; + border-radius: none; + padding: 0; +} + +div.rst-example > p.admonition-title { + font-family: Sans Serif; + font-style: italic; + font-size: 0.8em; + display: block; + border-bottom: 1px solid #ccc; + padding: 0.5em 1em; + text-align: right; +} + +/* code block in figures + */ + +div.highlight pre { + text-align: left; +} + +/* Table theme +*/ + +thead, tfoot { + background-color: #fff; +} + +th:hover, td:hover { + background-color: #ffc; +} + +thead th, tfoot th, tfoot td, tbody th { + background-color: #fffaef; +} + +tbody tr:nth-child(odd) { + background-color: #fff; +} + +tbody tr:nth-child(even) { + background-color: #fafafa; +} + +caption { + font-family: Sans Serif; + padding: 0.5em; + margin: 0.5em 0 0.5em 0; + caption-side: top; + text-align: left; +} diff --git a/docs/_themes/searx/theme.conf b/docs/_themes/searx/theme.conf new file mode 100644 index 000000000..2d5f72e7d --- /dev/null +++ b/docs/_themes/searx/theme.conf @@ -0,0 +1,6 @@ +[theme] +inherit = pocoo +stylesheet = searx.css + +[options] +touch_icon = diff --git a/docs/admin/api.rst b/docs/admin/api.rst new file mode 100644 index 000000000..7804a8664 --- /dev/null +++ b/docs/admin/api.rst @@ -0,0 +1,96 @@ +.. _adminapi: + +================== +Administration API +================== + +Get configuration data +====================== + +.. code:: http + + GET /config HTTP/1.1 + +Sample response +--------------- + +.. code:: json + + { + "autocomplete": "", + "categories": [ + "map", + "it", + "images", + ], + "default_locale": "", + "default_theme": "oscar", + "engines": [ + { + "categories": [ + "map" + ], + "enabled": true, + "name": "openstreetmap", + "shortcut": "osm" + }, + { + "categories": [ + "it" + ], + "enabled": true, + "name": "arch linux wiki", + "shortcut": "al" + }, + { + "categories": [ + "images" + ], + "enabled": true, + "name": "google images", + "shortcut": "goi" + }, + { + "categories": [ + "it" + ], + "enabled": false, + "name": "bitbucket", + "shortcut": "bb" + }, + ], + "instance_name": "searx", + "locales": { + "de": "Deutsch (German)", + "en": "English", + "eo": "Esperanto (Esperanto)", + }, + "plugins": [ + { + "enabled": true, + "name": "HTTPS rewrite" + }, + { + "enabled": false, + "name": "Vim-like hotkeys" + } + ], + "safe_search": 0 + } + + +Embed search bar +================ + +The search bar can be embedded into websites. Just paste the example into the +HTML of the site. URL of the searx instance and values are customizable. + +.. code:: html + +
+ + + + + +
diff --git a/docs/admin/arch_public.dot b/docs/admin/arch_public.dot new file mode 100644 index 000000000..a46c96de3 --- /dev/null +++ b/docs/admin/arch_public.dot @@ -0,0 +1,33 @@ +digraph G { + + node [style=filled, shape=box, fillcolor="#ffffcc", fontname="Sans"]; + edge [fontname="Sans"]; + + browser [label="Browser", shape=Mdiamond]; + rp [label="Reverse Proxy", href="url to configure reverse proxy"]; + filtron [label="Filtron", href="https://github.com/asciimoo/filtron"]; + morty [label="Morty", href="https://github.com/asciimoo/morty"]; + static [label="Static files", href="url to configure static files"]; + uwsgi [label="uwsgi", href="url to configure uwsgi"] + searx1 [label="Searx #1"]; + searx2 [label="Searx #2"]; + searx3 [label="Searx #3"]; + searx4 [label="Searx #4"]; + + browser -> rp [label="HTTPS"] + + subgraph cluster_searx { + label = "Searx instance" fontname="Sans"; + bgcolor="#fafafa"; + { rank=same; static rp }; + rp -> morty [label="optional: images and HTML pages proxy"]; + rp -> static [label="optional: reverse proxy serves directly static files"]; + rp -> filtron [label="HTTP"]; + filtron -> uwsgi [label="HTTP"]; + uwsgi -> searx1; + uwsgi -> searx2; + uwsgi -> searx3; + uwsgi -> searx4; + } + +} diff --git a/docs/admin/architecture.rst b/docs/admin/architecture.rst new file mode 100644 index 000000000..7064a294b --- /dev/null +++ b/docs/admin/architecture.rst @@ -0,0 +1,24 @@ +.. _architecture: + +============ +Architecture +============ + +.. sidebar:: Needs work! + + This article needs some work / Searx is a collaborative effort. If you have + any contribution, feel welcome to send us your :pull:`PR <../pulls>`, see + :ref:`how to contribute`. + +Herein you will find some hints and suggestions about typical architectures of +searx infrastructures. + +We start with a contribution from :pull:`@dalf <1776#issuecomment-567917320>`. +It shows a *reference* setup for public searx instances. + +.. _arch public: + +.. kernel-figure:: arch_public.dot + :alt: arch_public.dot + + Reference architecture of a public searx setup. diff --git a/docs/admin/buildhosts.rst b/docs/admin/buildhosts.rst new file mode 100644 index 000000000..5260da033 --- /dev/null +++ b/docs/admin/buildhosts.rst @@ -0,0 +1,103 @@ +.. _buildhosts: + +========== +Buildhosts +========== + +.. sidebar:: This article needs some work + + If you have any contribution send us your :pull:`PR <../pulls>`, see + :ref:`how to contribute`. + +To get best results from build, its recommend to install additional packages +on build hosts. + +.. _docs build: + +Build docs +========== + +.. _Graphviz: https://graphviz.gitlab.io +.. _ImageMagick: https://www.imagemagick.org +.. _XeTeX: https://tug.org/xetex/ +.. _dvisvgm: https://dvisvgm.de/ + +.. sidebar:: Sphinx build needs + + - ImageMagick_ + - Graphviz_ + - XeTeX_ + - dvisvgm_ + +Most of the sphinx requirements are installed from :origin:`setup.py` and the +docs can be build from scratch with ``make docs``. For better math and image +processing additional packages are needed. The XeTeX_ needed not only for PDF +creation, its also needed for :ref:`math` when HTML output is build. + +To be able to do :ref:`sphinx:math-support` without CDNs, the math are rendered +as images (``sphinx.ext.imgmath`` extension). If your docs build (``make +docs``) shows warnings like this:: + + WARNING: dot(1) not found, for better output quality install \ + graphviz from http://www.graphviz.org + .. + WARNING: LaTeX command 'latex' cannot be run (needed for math \ + display), check the imgmath_latex setting + +you need to install additional packages on your build host, to get better HTML +output. + +.. _system requirements: + +.. tabs:: + + .. group-tab:: Ubuntu / debian + + .. code-block:: sh + + $ sudo apt install graphviz imagemagick texlive-xetex librsvg2-bin + + .. group-tab:: Arch Linux + + .. code-block:: sh + + $ sudo pacman -S graphviz imagemagick texlive-bin extra/librsvg + + .. group-tab:: Fedora / RHEL + + .. code-block:: sh + + $ sudo dnf install graphviz graphviz-gd texlive-xetex-bin librsvg2-tools + + +For PDF output you also need: + +.. tabs:: + + .. group-tab:: Ubuntu / debian + + .. code:: sh + + $ sudo apt texlive-latex-recommended texlive-extra-utils ttf-dejavu + + .. group-tab:: Arch Linux + + .. code:: sh + + $ sudo pacman -S texlive-core texlive-latexextra ttf-dejavu + + .. group-tab:: Fedora / RHEL + + .. code:: sh + + $ sudo dnf install \ + texlive-collection-fontsrecommended texlive-collection-latex \ + dejavu-sans-fonts dejavu-serif-fonts dejavu-sans-mono-fonts + +.. _system requirements END: + +.. literalinclude:: ../conf.py + :language: python + :start-after: # sphinx.ext.imgmath setup + :end-before: # sphinx.ext.imgmath setup END + diff --git a/docs/admin/engines.rst b/docs/admin/engines.rst new file mode 100644 index 000000000..4b78c8c2b --- /dev/null +++ b/docs/admin/engines.rst @@ -0,0 +1,71 @@ +.. _engines generic: + +======= +Engines +======= + +.. sidebar:: Further reading .. + + - :ref:`settings engine` + - :ref:`engine settings` + - :ref:`engine file` + +============= =========== ==================== ============ +:ref:`engine settings` :ref:`engine file` +------------------------- --------------------------------- +Name (cfg) Categories +------------------------- --------------------------------- +Engine .. Paging support **P** +------------------------- -------------------- ------------ +Shortcut **S** Language support **L** +Timeout **TO** Time range support **TR** +Disabled **D** Offline **O** +------------- ----------- -------------------- ------------ +Safe search **SS** +------------- ----------- --------------------------------- +Weigth **W** +------------- ----------- --------------------------------- +Disabled **D** +============= =========== ================================= + +Configuration defaults (at built time): + +.. _configured engines: + +.. jinja:: webapp + + .. flat-table:: Engines configured at built time (defaults) + :header-rows: 1 + :stub-columns: 2 + + * - Name (cfg) + - S + - Engine + - TO + - Categories + - P + - L + - SS + - D + - TR + - O + - W + - D + + {% for name, mod in engines.items() %} + + * - {{name}} + - !{{mod.shortcut}} + - {{mod.__name__}} + - {{mod.timeout}} + - {{", ".join(mod.categories)}} + - {{(mod.paging and "y") or ""}} + - {{(mod.language_support and "y") or ""}} + - {{(mod.safesearch and "y") or ""}} + - {{(mod.disabled and "y") or ""}} + - {{(mod.time_range_support and "y") or ""}} + - {{(mod.offline and "y") or ""}} + - {{mod.weight or 1 }} + - {{(mod.disabled and "y") or ""}} + + {% endfor %} diff --git a/docs/admin/filtron.rst b/docs/admin/filtron.rst new file mode 100644 index 000000000..07dcb9bc5 --- /dev/null +++ b/docs/admin/filtron.rst @@ -0,0 +1,148 @@ +========================== +How to protect an instance +========================== + +Searx depens on external search services. To avoid the abuse of these services +it is advised to limit the number of requests processed by searx. + +An application firewall, ``filtron`` solves exactly this problem. Information +on how to install it can be found at the `project page of filtron +`__. + + +Sample configuration of filtron +=============================== + +An example configuration can be find below. This configuration limits the access +of: + +- scripts or applications (roboagent limit) +- webcrawlers (botlimit) +- IPs which send too many requests (IP limit) +- too many json, csv, etc. requests (rss/json limit) +- the same UserAgent of if too many requests (useragent limit) + +.. code:: json + + [{ + "name":"search request", + "filters":[ + "Param:q", + "Path=^(/|/search)$" + ], + "interval":"", + "limit":"", + "subrules":[ + { + "name":"roboagent limit", + "interval":"", + "limit":"", + "filters":[ + "Header:User-Agent=(curl|cURL|Wget|python-requests|Scrapy|FeedFetcher|Go-http-client)" + ], + "actions":[ + { + "name":"block", + "params":{ + "message":"Rate limit exceeded" + } + } + ] + }, + { + "name":"botlimit", + "limit":0, + "stop":true, + "filters":[ + "Header:User-Agent=(Googlebot|bingbot|Baiduspider|yacybot|YandexMobileBot|YandexBot|Yahoo! Slurp|MJ12bot|AhrefsBot|archive.org_bot|msnbot|MJ12bot|SeznamBot|linkdexbot|Netvibes|SMTBot|zgrab|James BOT)" + ], + "actions":[ + { + "name":"block", + "params":{ + "message":"Rate limit exceeded" + } + } + ] + }, + { + "name":"IP limit", + "interval":"", + "limit":"", + "stop":true, + "aggregations":[ + "Header:X-Forwarded-For" + ], + "actions":[ + { + "name":"block", + "params":{ + "message":"Rate limit exceeded" + } + } + ] + }, + { + "name":"rss/json limit", + "interval":"", + "limit":"", + "stop":true, + "filters":[ + "Param:format=(csv|json|rss)" + ], + "actions":[ + { + "name":"block", + "params":{ + "message":"Rate limit exceeded" + } + } + ] + }, + { + "name":"useragent limit", + "interval":"", + "limit":"", + "aggregations":[ + "Header:User-Agent" + ], + "actions":[ + { + "name":"block", + "params":{ + "message":"Rate limit exceeded" + } + } + ] + } + ] + }] + + + +Route request through filtron +============================= + +Filtron can be started using the following command: + +.. code:: sh + + $ filtron -rules rules.json + +It listens on ``127.0.0.1:4004`` and forwards filtered requests to +``127.0.0.1:8888`` by default. + +Use it along with ``nginx`` with the following example configuration. + +.. code:: nginx + + location / { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + proxy_pass http://127.0.0.1:4004/; + } + +Requests are coming from port 4004 going through filtron and then forwarded to +port 8888 where a searx is being run. diff --git a/docs/admin/index.rst b/docs/admin/index.rst new file mode 100644 index 000000000..b3c7f5119 --- /dev/null +++ b/docs/admin/index.rst @@ -0,0 +1,16 @@ +=========================== +Administrator documentation +=========================== + +.. toctree:: + :maxdepth: 1 + + installation + settings + api + architecture + filtron + morty + engines + plugins + buildhosts diff --git a/docs/admin/installation.rst b/docs/admin/installation.rst new file mode 100644 index 000000000..15800fc01 --- /dev/null +++ b/docs/admin/installation.rst @@ -0,0 +1,349 @@ +.. _installation: + +============ +Installation +============ + +.. contents:: + :depth: 3 + +Basic installation +================== + +Step by step installation for Debian/Ubuntu with virtualenv. For Ubuntu, be sure +to have enable universe repository. + +Install packages: + +.. code:: sh + + $ sudo -H apt-get install \ + git build-essential libxslt-dev \ + python-dev python-virtualenv python-babel \ + zlib1g-dev libffi-dev libssl-dev + +Install searx: + +.. code:: sh + + cd /usr/local + sudo -H git clone https://github.com/asciimoo/searx.git + sudo -H useradd searx -d /usr/local/searx + sudo -H chown searx:searx -R /usr/local/searx + +Install dependencies in a virtualenv: + +.. code:: sh + + cd /usr/local/searx + sudo -H -u searx -i + +.. code:: sh + + (searx)$ virtualenv searx-ve + (searx)$ . ./searx-ve/bin/activate + (searx)$ ./manage.sh update_packages + +Configuration +============== + +.. code:: sh + + sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml + +Edit searx/settings.yml if necessary. + +Check +===== + +Start searx: + +.. code:: sh + + python searx/webapp.py + +Go to http://localhost:8888 + +If everything works fine, disable the debug option in settings.yml: + +.. code:: sh + + sed -i -e "s/debug : True/debug : False/g" searx/settings.yml + +At this point searx is not demonized ; uwsgi allows this. + +You can exit the virtualenv and the searx user bash (enter exit command +twice). + +uwsgi +===== + +Install packages: + +.. code:: sh + + sudo -H apt-get install \ + uwsgi uwsgi-plugin-python + +Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this +content: + +.. code:: ini + + [uwsgi] + # Who will run the code + uid = searx + gid = searx + + # disable logging for privacy + disable-logging = true + + # Number of workers (usually CPU count) + workers = 4 + + # The right granted on the created socket + chmod-socket = 666 + + # Plugin to use and interpretor config + single-interpreter = true + master = true + plugin = python + lazy-apps = true + enable-threads = true + + # Module to import + module = searx.webapp + + # Support running the module from a webserver subdirectory. + route-run = fixpathinfo: + + # Virtualenv and python path + virtualenv = /usr/local/searx/searx-ve/ + pythonpath = /usr/local/searx/ + chdir = /usr/local/searx/searx/ + +Activate the uwsgi application and restart: + +.. code:: sh + + cd /etc/uwsgi/apps-enabled + ln -s ../apps-available/searx.ini + /etc/init.d/uwsgi restart + +Web server +========== + +with nginx +---------- + +If nginx is not installed (uwsgi will not work with the package +nginx-light): + +.. code:: sh + + sudo -H apt-get install nginx + +Hosted at / +~~~~~~~~~~~ + +Create the configuration file ``/etc/nginx/sites-available/searx`` with this +content: + +.. code:: nginx + + server { + listen 80; + server_name searx.example.com; + root /usr/local/searx/searx; + + location /static { + } + + location / { + include uwsgi_params; + uwsgi_pass unix:/run/uwsgi/app/searx/socket; + } + } + +Create a symlink to sites-enabled: + +.. code:: sh + + sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx + +Restart service: + +.. code:: sh + + sudo -H service nginx restart + sudo -H service uwsgi restart + +from subdirectory URL (/searx) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Add this configuration in the server config file +``/etc/nginx/sites-enabled/default``: + +.. code:: nginx + + location /searx/static { + alias /usr/local/searx/searx/static; + } + + location /searx { + uwsgi_param SCRIPT_NAME /searx; + include uwsgi_params; + uwsgi_pass unix:/run/uwsgi/app/searx/socket; + } + + +**OR** using reverse proxy (Please, note that reverse proxy advised to be used +in case of single-user or low-traffic instances.) + +.. code:: nginx + + location /searx/static { + alias /usr/local/searx/searx/static; + } + + location /searx { + proxy_pass http://127.0.0.1:8888; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + proxy_set_header X-Script-Name /searx; + proxy_buffering off; + } + + +Enable ``base_url`` in ``searx/settings.yml`` + +.. code:: yaml + + base_url : http://your.domain.tld/searx/ + +Restart service: + +.. code:: sh + + sudo -H service nginx restart + sudo -H service uwsgi restart + +disable logs +^^^^^^^^^^^^ + +for better privacy you can disable nginx logs about searx. + +how to proceed: below ``uwsgi_pass`` in ``/etc/nginx/sites-available/default`` +add: + +.. code:: nginx + + access_log /dev/null; + error_log /dev/null; + +Restart service: + +.. code:: sh + + sudo -H service nginx restart + +with apache +----------- + +Add wsgi mod: + +.. code:: sh + + sudo -H apt-get install libapache2-mod-uwsgi + sudo -H a2enmod uwsgi + +Add this configuration in the file ``/etc/apache2/apache2.conf``: + +.. code:: apache + + + Options FollowSymLinks Indexes + SetHandler uwsgi-handler + uWSGISocket /run/uwsgi/app/searx/socket + + +Note that if your instance of searx is not at the root, you should change +```` by the location of your instance, like ````. + +Restart Apache: + +.. code:: sh + + sudo -H /etc/init.d/apache2 restart + +disable logs +~~~~~~~~~~~~ + +For better privacy you can disable Apache logs. + +.. warning:: + + You can only disable logs for the whole (virtual) server not for a specific + path. + +Go back to ``/etc/apache2/apache2.conf`` and above ```` add: + +.. code:: apache + + CustomLog /dev/null combined + +Restart Apache: + +.. code:: sh + + sudo -H /etc/init.d/apache2 restart + +How to update +============= + +.. code:: sh + + cd /usr/local/searx + sudo -H -u searx -i + +.. code:: sh + + (searx)$ . ./searx-ve/bin/activate + (searx)$ git stash + (searx)$ git pull origin master + (searx)$ git stash apply + (searx)$ ./manage.sh update_packages + +.. code:: sh + + sudo -H service uwsgi restart + +Docker +====== + +Make sure you have installed Docker. For instance, you can deploy searx like this: + +.. code:: sh + + docker pull wonderfall/searx + docker run -d --name searx -p $PORT:8888 wonderfall/searx + +Go to ``http://localhost:$PORT``. + +See https://hub.docker.com/r/wonderfall/searx/ for more informations. It's also +possible to build searx from the embedded Dockerfile. + +.. code:: sh + + git clone https://github.com/asciimoo/searx.git + cd searx + docker build -t whatever/searx . + +References +========== + +* https://about.okhin.fr/posts/Searx/ with some additions + +* How to: `Setup searx in a couple of hours with a free SSL certificate + `__ diff --git a/docs/admin/morty.rst b/docs/admin/morty.rst new file mode 100644 index 000000000..7d7b34492 --- /dev/null +++ b/docs/admin/morty.rst @@ -0,0 +1,26 @@ +========================= +How to setup result proxy +========================= + +.. _morty: https://github.com/asciimoo/morty +.. _morty's README: https://github.com/asciimoo/morty + +By default searx can only act as an image proxy for result images, but it is +possible to proxify all the result URLs with an external service, morty_. + +To use this feature, morty has to be installed and activated in searx's +``settings.yml``. + +Add the following snippet to your ``settings.yml`` and restart searx: + +.. code:: yaml + + result_proxy: + url : http://127.0.0.1:3000/ + key : your_morty_proxy_key + +``url`` + Is the address of the running morty service. + +``key`` + Is an optional argument, see `morty's README`_ for more information. diff --git a/docs/admin/plugins.rst b/docs/admin/plugins.rst new file mode 100644 index 000000000..4ed9066fd --- /dev/null +++ b/docs/admin/plugins.rst @@ -0,0 +1,39 @@ +.. _plugins generic: + +=============== +Plugins builtin +=============== + +.. sidebar:: Further reading .. + + - :ref:`dev plugin` + +Configuration defaults (at built time): + +:DO: Default on + +.. _configured plugins: + +.. jinja:: webapp + + .. flat-table:: Plugins configured at built time (defaults) + :header-rows: 1 + :stub-columns: 1 + :widths: 3 1 9 + + * - Name + - DO + - Description + + JS & CSS dependencies + + {% for plgin in plugins %} + + * - {{plgin.name}} + - {{(plgin.default_on and "y") or ""}} + - {{plgin.description}} + + {% for dep in (plgin.js_dependencies + plgin.css_dependencies) %} + | ``{{dep}}`` {% endfor %} + + {% endfor %} diff --git a/docs/admin/settings.rst b/docs/admin/settings.rst new file mode 100644 index 000000000..0bfdcc6cb --- /dev/null +++ b/docs/admin/settings.rst @@ -0,0 +1,181 @@ +.. _settings.yml: + +================ +``settings.yml`` +================ + +.. sidebar:: Further reading .. + + - :ref:`search API` + +This page describe the options possibilities of the settings.yml file. + +.. _settings global: + +Global Settings +=============== + +.. code:: yaml + + server: + port : 8888 + secret_key : "ultrasecretkey" # change this! + debug : False # debug mode, only for development + request_timeout : 2.0 # seconds + base_url : False # set custom base_url (or False) + themes_path : "" # custom ui themes path + default_theme : oscar # ui theme + useragent_suffix : "" # suffix of searx_useragent, could contain + # informations like admins email address + image_proxy : False # proxying image results through searx + default_locale : "" # default interface locale + + # uncomment below section if you want to use a proxy + + #outgoing_proxies : + # http : http://127.0.0.1:8080 + # https: http://127.0.0.1:8080 + + # uncomment below section only if you have more than one network interface + # which can be the source of outgoing search requests + + #source_ips: + # - 1.1.1.1 + # - 1.1.1.2 + + locales: + en : English + de : Deutsch + he : Hebrew + hu : Magyar + fr : Français + es : Español + it : Italiano + nl : Nederlands + ja : 日本語 (Japanese) + tr : Türkçe + ru : Russian + ro : Romanian + + +``port`` : + Port number of the searx web application if you run it directly using ``python + searx/webapp.py``. Doesn't apply to searx running on Apache or Nginx. + +``secret_key`` : + Used for cryptography purpose. + +``debug`` : + Allow a more detailed log if you run searx directly. Display *detailed* error + messages in the browser too, so this must be deactivated in production. + +``request_timeout`` : + Global timeout of the requests made to others engines in seconds. A bigger + timeout will allow to wait for answers from slow engines, but in consequence + will slow searx reactivity (the result page may take the time specified in the + timeout to load) + +``base_url`` : + The base URL where searx is deployed. Used to create correct inbound links. + +``themes_path`` : + Path to where the themes are located. If you didn't develop anything, leave it + blank. + +``default_theme`` : + Name of the theme you want to use by default on you searx instance. + +``useragent_suffix`` : + Suffix to the user-agent searx uses to send requests to others engines. If an + engine wish to block you, a contact info here may be useful to avoid that. + +``image_proxy`` : + Allow your instance of searx of being able to proxy images. Uses memory space. + +``default_locale`` : + Aearx interface language. If blank, the locale is detected by using the + browser language. If it doesn't work, or you are deploying a language + specific instance of searx, a locale can be defined using an ISO language + code, like ``fr``, ``en``, ``de``. + +.. _requests proxies: http://docs.python-requests.org/en/latest/user/advanced/#proxies +.. _PR SOCKS support: https://github.com/kennethreitz/requests/pull/478 + +``outgoing_proxies`` : + Define a proxy you wish to use, see `requests proxies`_. SOCKS proxies are + not supported / see `PR SOCKS support`. + +``source_ips`` : + If you use multiple nework interfaces, define from which IP the requests must + be made. + +``locales`` : + Locales codes and their names. Available translations of searx interface. + + +.. _settings engine: + +Engine settings +=============== + +.. sidebar:: Further reading .. + + - :ref:`engines-dev` + +.. code:: yaml + + - name : bing + engine : bing + shortcut : bi + base_url : 'https://{language}.wikipedia.org/' + categories : general + timeout : 3.0 + api_key : 'apikey' + disabled : True + language : en_US + +``name`` : + Name that will be used accross searx to define this engine. In settings, on + the result page... + +``engine`` : + Name of the python file used to handle requests and responses to and from this + search engine. + +``shortcut`` : + Code used to execute bang requests (in this case using ``!bi`` or ``?bi``) + +``base_url`` : optional + Part of the URL that should be stable accross every request. Can be useful to + use multiple sites using only one engine, or updating the site URL without + touching at the code. + +``categories`` : optional + Define in which categories this engine will be active. Most of the time, it is + defined in the code of the engine, but in a few cases it is useful, like when + describing multiple search engine using the same code. + +``timeout`` : optional + Timeout of the search with the current search engine. **Be careful, it will + modify the global timeout of searx.** + +``api_key`` : optional + In a few cases, using an API needs the use of a secret key. How to obtain them + is described in the file. + +``disabled`` : optional + To disable by default the engine, but not deleting it. It will allow the user + to manually activate it in the settings. + +``language`` : optional + If you want to use another language for a specific engine, you can define it + by using the full ISO code of language and country, like ``fr_FR``, ``en_US``, + ``de_DE``. + +``weigth`` : default ``1`` + Weighting of the results of this engine. + +.. note:: + + A few more options are possible, but they are pretty specific to some + engines, and so won't be described here. diff --git a/docs/blog/admin.rst b/docs/blog/admin.rst new file mode 100644 index 000000000..e95316192 --- /dev/null +++ b/docs/blog/admin.rst @@ -0,0 +1,43 @@ +============================================================= +Searx admin interface +============================================================= + +.. _searx-admin: https://github.com/kvch/searx-admin#searx-admin +.. _NLnet Foundation: https://nlnet.nl/ + + manage your instance from your browser + +.. sidebar:: Installation + + Installation guide can be found in the repository of searx-admin_. + +One of the biggest advantages of searx is being extremely customizable. But at +first it can be daunting to newcomers. A barrier of taking advantage of this +feature is our ugly settings file which is sometimes hard to understand and +edit. + +To make self-hosting searx more accessible a new tool is introduced, called +``searx-admin``. It is a web application which is capable of managing your +instance and manipulating its settings via a web UI. It aims to replace editing +of ``settings.yml`` for less experienced administrators or people who prefer +graphical admin interfaces. + +.. figure:: searx-admin-engines.png + :alt: Screenshot of engine list + + Configuration page of engines + +Since ``searx-admin`` acts as a supervisor for searx, we have decided to +implement it as a standalone tool instead of part of searx. Another reason for +making it a standalone tool is that the codebase and dependencies of searx +should not grow because of a fully optional feature, which does not affect +existing instances. + + +Acknowledgements +================ + +This development was sponsored by `NLnet Foundation`_. + +| Happy hacking. +| kvch // 2017.08.22 21:25 diff --git a/docs/blog/index.rst b/docs/blog/index.rst new file mode 100644 index 000000000..52fa3f126 --- /dev/null +++ b/docs/blog/index.rst @@ -0,0 +1,10 @@ +==== +Blog +==== + +.. toctree:: + :maxdepth: 1 + + python3 + admin + intro-offline diff --git a/docs/blog/intro-offline.rst b/docs/blog/intro-offline.rst new file mode 100644 index 000000000..f6e90de3a --- /dev/null +++ b/docs/blog/intro-offline.rst @@ -0,0 +1,77 @@ +=============================== +Preparation for offline engines +=============================== + +Offline engines +=============== + +To extend the functionality of searx, offline engines are going to be +introduced. An offline engine is an engine which does not need Internet +connection to perform a search and does not use HTTP to communicate. + +Offline engines can be configured as online engines, by adding those to the +`engines` list of :origin:`settings.yml `. Thus, searx +finds the engine file and imports it. + +Example skeleton for the new engines: + +.. code:: python + + from subprocess import PIPE, Popen + + categories = ['general'] + offline = True + + def init(settings): + pass + + def search(query, params): + process = Popen(['ls', query], stdout=PIPE) + return_code = process.wait() + if return_code != 0: + raise RuntimeError('non-zero return code', return_code) + + results = [] + line = process.stdout.readline() + while line: + result = parse_line(line) + results.append(results) + + line = process.stdout.readline() + + return results + + +Development progress +==================== + +First, a proposal has been created as a Github issue. Then it was moved to the +wiki as a design document. You can read it here: :wiki:`Offline-engines`. + +In this development step, searx core was prepared to accept and perform offline +searches. Offline search requests are scheduled together with regular offline +requests. + +As offline searches can return arbitrary results depending on the engine, the +current result templates were insufficient to present such results. Thus, a new +template is introduced which is caplable of presenting arbitrary key value pairs +as a table. You can check out the pull request for more details see +:pull:`1700`. + +Next steps +========== + +Today, it is possible to create/run an offline engine. However, it is going to be publicly available for everyone who knows the searx instance. So the next step is to introduce token based access for engines. This way administrators are able to limit the access to private engines. + +Acknowledgement +=============== + +This development was sponsored by `Search and Discovery Fund`_ of `NLnet Foundation`_ . + +.. _Search and Discovery Fund: https://nlnet.nl/discovery +.. _NLnet Foundation: https://nlnet.nl/ + + +| Happy hacking. +| kvch // 2019.10.21 17:03 + diff --git a/docs/blog/python3.rst b/docs/blog/python3.rst new file mode 100644 index 000000000..5bb7f1c80 --- /dev/null +++ b/docs/blog/python3.rst @@ -0,0 +1,68 @@ +============================ +Introducing Python 3 support +============================ + +.. _Python 2.7 clock: https://pythonclock.org/ + +.. sidebar:: Python 2.7 to 3 upgrade + + This chapter exists of historical reasons. Python 2.7 release schedule ends + (`Python 2.7 clock`_) after 11 years Python 3 exists + +As most operation systems are coming with Python3 installed by default. So it is +time for searx to support Python3. But don't worry support of Python2.7 won't be +dropped. + +.. image:: searxpy3.png + :scale: 50 % + :alt: hurray + :align: center + + +How to run searx using Python 3 +=============================== + +Please make sure that you run at least Python 3.5. + +To run searx, first a Python3 virtualenv should be created. After entering the +virtualenv, dependencies must be installed. Then run searx with python3 instead +of the usual python command. + +.. code:: sh + + virtualenv -p python3 venv3 + source venv3/bin/activate + pip3 install -r requirements.txt + python3 searx/webapp.py + + +If you want to run searx using Python2.7, you don't have to do anything +differently as before. + +Fun facts +========= + +- 115 files were changed when implementing the support for both Python versions. + +- All of the dependencies was compatible except for the robotframework used for + browser tests. Thus, these tests were migrated to splinter. So from now on + both versions are being tested on Travis and can be tested locally. + +If you found bugs +================= + +Please open an issue on `GitHub`_. Make sure that you mention your Python +version in your issue, so we can investigate it properly. + +.. _GitHub: https://github.com/asciimoo/searx/issues + +Acknowledgment +============== + +This development was sponsored by `NLnet Foundation`_. + +.. _NLnet Foundation: https://nlnet.nl/ + + +| Happy hacking. +| kvch // 2017.05.13 22:57 diff --git a/docs/blog/searx-admin-engines.png b/docs/blog/searx-admin-engines.png new file mode 100644 index 000000000..610bacdf7 Binary files /dev/null and b/docs/blog/searx-admin-engines.png differ diff --git a/docs/blog/searxpy3.png b/docs/blog/searxpy3.png new file mode 100644 index 000000000..8eeaeec55 Binary files /dev/null and b/docs/blog/searxpy3.png differ diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..af255e230 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- + +import sys, os +from searx.version import VERSION_STRING +from pallets_sphinx_themes import ProjectLink + +GIT_URL = os.environ.get("GIT_URL", "https://github.com/asciimoo/searx") +SEARX_URL = os.environ.get("SEARX_URL", "https://searx.me") +DOCS_URL = os.environ.get("DOCS_URL", "https://asciimoo.github.io/searx/") + +# Project -------------------------------------------------------------- + +project = u'searx' +copyright = u'2015-2019, Adam Tauber, Noémi Ványi' +author = u'Adam Tauber' +release, version = VERSION_STRING, VERSION_STRING +highlight_language = 'none' + +# General -------------------------------------------------------------- + +master_doc = "index" +source_suffix = '.rst' +numfig = True + +from searx import webapp +jinja_contexts = { + 'webapp': dict(**webapp.__dict__) +} + +# usage:: lorem :patch:`f373169` ipsum +extlinks = {} + +# upstream links +extlinks['wiki'] = ('https://github.com/asciimoo/searx/wiki/%s', ' ') +extlinks['pull'] = ('https://github.com/asciimoo/searx/pull/%s', 'PR ') + +# links to custom brand +extlinks['origin'] = (GIT_URL + '/blob/master/%s', 'git://') +extlinks['patch'] = (GIT_URL + '/commit/%s', '#') +extlinks['search'] = (SEARX_URL + '/%s', '#') +extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ') +extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ') +extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '') +#extlinks['role'] = ( +# 'https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-%s', '') +extlinks['duref'] = ( + 'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#%s', '') +extlinks['durole'] = ( + 'http://docutils.sourceforge.net/docs/ref/rst/roles.html#%s', '') +extlinks['dudir'] = ( + 'http://docutils.sourceforge.net/docs/ref/rst/directives.html#%s', '') +extlinks['ctan'] = ( + 'https://ctan.org/pkg/%s', 'CTAN: ') + +extensions = [ + 'sphinx.ext.imgmath', + 'sphinx.ext.extlinks', + 'sphinx.ext.viewcode', + "sphinx.ext.autodoc", + "sphinx.ext.intersphinx", + "pallets_sphinx_themes", + "sphinx_issues", # https://github.com/sloria/sphinx-issues/blob/master/README.rst + "sphinxcontrib.jinja", # https://github.com/tardyp/sphinx-jinja + 'linuxdoc.rstFlatTable', # Implementation of the 'flat-table' reST-directive. + 'linuxdoc.kfigure', # Sphinx extension which implements scalable image handling. + "sphinx_tabs.tabs", # https://github.com/djungelorm/sphinx-tabs +] + +intersphinx_mapping = { + "python": ("https://docs.python.org/3/", None), + "flask": ("https://flask.palletsprojects.com/", None), + # "werkzeug": ("https://werkzeug.palletsprojects.com/", None), + "jinja": ("https://jinja.palletsprojects.com/", None), + "linuxdoc" : ("https://return42.github.io/linuxdoc/", None), + "sphinx" : ("https://www.sphinx-doc.org/en/master/", None), +} + +issues_github_path = "asciimoo/searx" + +# HTML ----------------------------------------------------------------- + +sys.path.append(os.path.abspath('_themes')) +html_theme_path = ['_themes'] +html_theme = "searx" + +# sphinx.ext.imgmath setup +html_math_renderer = 'imgmath' +imgmath_image_format = 'svg' +imgmath_font_size = 14 +# sphinx.ext.imgmath setup END + +html_theme_options = {"index_sidebar_logo": True} +html_context = { + "project_links": [ + ProjectLink("Source", GIT_URL), + ProjectLink("Wiki", "https://github.com/asciimoo/searx/wiki"), + ProjectLink("Public instances", "https://asciimoo.github.io/searx/user/public_instances.html"), + ProjectLink("Twitter", "https://twitter.com/Searx_engine"), + ] +} +html_sidebars = { + "**": ["project.html", "relations.html", "searchbox.html"], +} +singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]} +html_static_path = ["static"] +html_logo = "static/img/searx_logo_small.png" +html_title = "Searx Documentation ({})".format("Searx-{}.tex".format(VERSION_STRING)) +html_show_sourcelink = False + +# LaTeX ---------------------------------------------------------------- + +latex_documents = [ + (master_doc, "searx-{}.tex".format(VERSION_STRING), html_title, author, "manual") +] diff --git a/docs/dev/contribution_guide.rst b/docs/dev/contribution_guide.rst new file mode 100644 index 000000000..459dfb448 --- /dev/null +++ b/docs/dev/contribution_guide.rst @@ -0,0 +1,180 @@ +.. _how to contribute: + +================= +How to contribute +================= + +Prime directives: Privacy, Hackability +====================================== + +Searx has two prime directives, **privacy-by-design and hackability** . The +hackability comes in three levels: + +- support of search engines +- plugins to alter search behaviour +- hacking searx itself + +Note the lack of "world domination" among the directives. Searx has no +intention of wide mass-adoption, rounded corners, etc. The prime directive +"privacy" deserves a separate chapter, as it's quite uncommon unfortunately. + +Privacy-by-design +----------------- + +Searx was born out of the need for a **privacy-respecting** search tool which +can be extended easily to maximize both, its search and its privacy protecting +capabilities. + +A few widely used features work differently or turned off by default or not +implemented at all **as a consequence of privacy-by-design**. + +If a feature reduces the privacy preserving aspects of searx, it should be +switched off by default or should not implemented at all. There are plenty of +search engines already providing such features. If a feature reduces the +protection of searx, users must be informed about the effect of choosing to +enable it. Features that protect privacy but differ from the expectations of +the user should also be explained. + +Also, if you think that something works weird with searx, it's might be because +of the tool you use is designed in a way to interfere with the privacy respect. +Submitting a bugreport to the vendor of the tool that misbehaves might be a good +feedback to reconsider the disrespect to its customers (e.g. ``GET`` vs ``POST`` +requests in various browsers). + +Remember the other prime directive of searx is to be hackable, so if the above +privacy concerns do not fancy you, simply fork it. + + *Happy hacking.* + +Code +==== + +.. _PEP8: https://www.python.org/dev/peps/pep-0008/ +.. _Conventional Commits: https://www.conventionalcommits.org/ +.. _Git Commit Good Practice: https://wiki.openstack.org/wiki/GitCommitMessages +.. _Structural split of changes: + https://wiki.openstack.org/wiki/GitCommitMessages#Structural_split_of_changes +.. _gitmoji: https://gitmoji.carloscuesta.me/ +.. _Semantic PR: https://github.com/zeke/semantic-pull-requests + +.. sidebar:: Create good commits! + + - `Structural split of changes`_ + - `Conventional Commits`_ + - `Git Commit Good Practice`_ + - some like to use: gitmoji_ + - not yet active: `Semantic PR`_ + +In order to submit a patch, please follow the steps below: + +- Follow coding conventions. + + - PEP8_ standards apply, except the convention of line length + - Maximum line length is 120 characters + +- The cardinal rule for creating good commits is to ensure there is only one + *logical change* per commit / read `Structural split of changes`_ + +- Check if your code breaks existing tests. If so, update the tests or fix your + code. + +- If your code can be unit-tested, add unit tests. + +- Add yourself to the :origin:`AUTHORS.rst` file. + +- Choose meaning full commit messages, read `Conventional Commits`_ + + .. code:: + + [optional scope]: + + [optional body] + + [optional footer(s)] + +- Create a pull request. + +For more help on getting started with searx development, see :ref:`devquickstart`. + + +Translation +=========== + +Translation currently takes place on :ref:`transifex `. + +.. caution:: + + Please, do not update translation files in the repo. + + +.. _contrib docs: + +Documentation +============= + +.. _Sphinx: http://www.sphinx-doc.org +.. _reST: http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html + +.. sidebar:: The reST sources + + has been moved from ``gh-branch`` into ``master`` (:origin:`docs`). + +The documentation is built using Sphinx_. So in order to be able to generate +the required files, you have to install it on your system. Much easier, use +our :ref:`makefile`. + +Here is an example which makes a complete rebuild: + +.. code:: sh + + $ make docs-clean docs + ... + The HTML pages are in dist/docs. + +.. _make docs-live: + +live build +---------- + +.. sidebar:: docs-clean + + It is recommended to assert a complete rebuild before deploying (use + ``docs-clean``). + +Live build is like WYSIWYG. If you want to edit the documentation, its +recommended to use. The Makefile target ``docs-live`` builds the docs, opens +URL in your favorite browser and rebuilds every time a reST file has been +changed. + +.. code:: sh + + $ make docs-live + ... + The HTML pages are in dist/docs. + ... Serving on http://0.0.0.0:8080 + ... Start watching changes + + +.. _deploy on github.io: + +deploy on github.io +------------------- + +To deploy documentation at :docs:`github.io <.>` use Makefile target +:ref:`make gh-pages`, which will builds the documentation, clones searx into a sub +folder ``gh-pages``, cleans it, copies the doc build into and runs all the +needed git add, commit and push: + +.. code:: sh + + $ make docs-clean gh-pages + ... + SPHINX docs --> file://<...>/dist/docs + The HTML pages are in dist/docs. + ... + Cloning into 'gh-pages' ... + ... + cd gh-pages; git checkout gh-pages >/dev/null + Switched to a new branch 'gh-pages' + ... + doc available at --> https://asciimoo.github.io/searx diff --git a/docs/dev/csv_table.txt b/docs/dev/csv_table.txt new file mode 100644 index 000000000..8a1454137 --- /dev/null +++ b/docs/dev/csv_table.txt @@ -0,0 +1,6 @@ +stub col row 1, column, "loremLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy +eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam +voluptua." +stub col row 1, "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita +kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.", column +stub col row 1, column, column diff --git a/docs/dev/engine_overview.rst b/docs/dev/engine_overview.rst new file mode 100644 index 000000000..449c837a9 --- /dev/null +++ b/docs/dev/engine_overview.rst @@ -0,0 +1,267 @@ + +.. _engines-dev: + +=============== +Engine overview +=============== + +.. _metasearch-engine: https://en.wikipedia.org/wiki/Metasearch_engine + +searx is a metasearch-engine_, so it uses different search engines to provide +better results. + +Because there is no general search API which could be used for every search +engine, an adapter has to be built between searx and the external search +engines. Adapters are stored under the folder :origin:`searx/engines`. + +.. contents:: + :depth: 3 + :backlinks: entry + +general engine configuration +============================ + +It is required to tell searx the type of results the engine provides. The +arguments can be set in the engine file or in the settings file +(normally ``settings.yml``). The arguments in the settings file override +the ones in the engine file. + +It does not matter if an option is stored in the engine file or in the +settings. However, the standard way is the following: + +.. _engine file: + +engine file +----------- + +======================= =========== =========================================== +argument type information +======================= =========== =========================================== +categories list pages, in which the engine is working +paging boolean support multible pages +language_support boolean support language choosing +time_range_support boolean support search time range +offline boolean engine runs offline +======================= =========== =========================================== + +.. _engine settings: + +settings.yml +------------ + +======================= =========== =========================================== +argument type information +======================= =========== =========================================== +name string name of search-engine +engine string name of searx-engine + (filename without ``.py``) +shortcut string shortcut of search-engine +timeout string specific timeout for search-engine +======================= =========== =========================================== + + +overrides +--------- + +A few of the options have default values in the engine, but are often +overwritten by the settings. If ``None`` is assigned to an option in the engine +file, it has to be redefined in the settings, otherwise searx will not start +with that engine. + +The naming of overrides is arbitrary. But the recommended overrides are the +following: + +======================= =========== =========================================== +argument type information +======================= =========== =========================================== +base_url string base-url, can be overwritten to use same + engine on other URL +number_of_results int maximum number of results per request +language string ISO code of language and country like en_US +api_key string api-key if required by engine +======================= =========== =========================================== + +example code +------------ + +.. code:: python + + # engine dependent config + categories = ['general'] + paging = True + language_support = True + + +making a request +================ + +To perform a search an URL have to be specified. In addition to specifying an +URL, arguments can be passed to the query. + +passed arguments +---------------- + +These arguments can be used to construct the search query. Furthermore, +parameters with default value can be redefined for special purposes. + +====================== ============ ======================================================================== +argument type default-value, information +====================== ============ ======================================================================== +url string ``''`` +method string ``'GET'`` +headers set ``{}`` +data set ``{}`` +cookies set ``{}`` +verify boolean ``True`` +headers.User-Agent string a random User-Agent +category string current category, like ``'general'`` +started datetime current date-time +pageno int current pagenumber +language string specific language code like ``'en_US'``, or ``'all'`` if unspecified +====================== ============ ======================================================================== + +parsed arguments +---------------- + +The function ``def request(query, params):`` always returns the ``params`` +variable. Inside searx, the following paramters can be used to specify a search +request: + +============ =========== ========================================================= +argument type information +============ =========== ========================================================= +url string requested url +method string HTTP request method +headers set HTTP header information +data set HTTP data information (parsed if ``method != 'GET'``) +cookies set HTTP cookies +verify boolean Performing SSL-Validity check +============ =========== ========================================================= + + +example code +------------ + +.. code:: python + + # search-url + base_url = 'https://example.com/' + search_string = 'search?{query}&page={page}' + + # do search-request + def request(query, params): + search_path = search_string.format( + query=urlencode({'q': query}), + page=params['pageno']) + + params['url'] = base_url + search_path + + return params + + +returned results +================ + +Searx is able to return results of different media-types. Currently the +following media-types are supported: + +- default_ +- images_ +- videos_ +- torrent_ +- map_ + +To set another media-type as default, the parameter ``template`` must be set to +the desired type. + +default +------- + +========================= ===================================================== +result-parameter information +========================= ===================================================== +url string, url of the result +title string, title of the result +content string, general result-text +publishedDate :py:class:`datetime.datetime`, time of publish +========================= ===================================================== + +images +------ + +To use this template, the parameter: + +========================= ===================================================== +result-parameter information +========================= ===================================================== +template is set to ``images.html`` +url string, url to the result site +title string, title of the result *(partly implemented)* +content *(partly implemented)* +publishedDate :py:class:`datetime.datetime`, + time of publish *(partly implemented)* +img\_src string, url to the result image +thumbnail\_src string, url to a small-preview image +========================= ===================================================== + +videos +------ + +========================= ===================================================== +result-parameter information +========================= ===================================================== +template is set to ``videos.html`` +url string, url of the result +title string, title of the result +content *(not implemented yet)* +publishedDate :py:class:`datetime.datetime`, time of publish +thumbnail string, url to a small-preview image +========================= ===================================================== + +torrent +------- + +.. _magnetlink: https://en.wikipedia.org/wiki/Magnet_URI_scheme + +========================= ===================================================== +result-parameter information +========================= ===================================================== +template is set to ``torrent.html`` +url string, url of the result +title string, title of the result +content string, general result-text +publishedDate :py:class:`datetime.datetime`, + time of publish *(not implemented yet)* +seed int, number of seeder +leech int, number of leecher +filesize int, size of file in bytes +files int, number of files +magnetlink string, magnetlink_ of the result +torrentfile string, torrentfile of the result +========================= ===================================================== + + +map +--- + +========================= ===================================================== +result-parameter information +========================= ===================================================== +url string, url of the result +title string, title of the result +content string, general result-text +publishedDate :py:class:`datetime.datetime`, time of publish +latitude latitude of result (in decimal format) +longitude longitude of result (in decimal format) +boundingbox boundingbox of result (array of 4. values + ``[lat-min, lat-max, lon-min, lon-max]``) +geojson geojson of result (http://geojson.org) +osm.type type of osm-object (if OSM-Result) +osm.id id of osm-object (if OSM-Result) +address.name name of object +address.road street name of object +address.house_number house number of object +address.locality city, place of object +address.postcode postcode of object +address.country country of object +========================= ===================================================== diff --git a/docs/dev/hello.dot b/docs/dev/hello.dot new file mode 100644 index 000000000..504621dfc --- /dev/null +++ b/docs/dev/hello.dot @@ -0,0 +1,3 @@ +graph G { + Hello -- World +} diff --git a/docs/dev/index.rst b/docs/dev/index.rst new file mode 100644 index 000000000..cb913a82b --- /dev/null +++ b/docs/dev/index.rst @@ -0,0 +1,15 @@ +======================= +Developer documentation +======================= + +.. toctree:: + :maxdepth: 1 + + quickstart + contribution_guide + engine_overview + search_api + plugins + translation + makefile + reST diff --git a/docs/dev/makefile.rst b/docs/dev/makefile.rst new file mode 100644 index 000000000..f5957001c --- /dev/null +++ b/docs/dev/makefile.rst @@ -0,0 +1,221 @@ +.. _makefile: + +================ +Makefile Targets +================ + +.. _gnu-make: https://www.gnu.org/software/make/manual/make.html#Introduction + +.. sidebar:: build environment + + Before looking deeper at the targets, first read about :ref:`makefile setup` + and :ref:`make pyenv`. + +With the aim to simplify development cycles, started with :pull:`1756` a +``Makefile`` based boilerplate was added. If you are not familiar with +Makefiles, we recommend to read gnu-make_ introduction. + +The usage is simple, just type ``make {target-name}`` to *build* a target. +Calling the ``help`` target gives a first overview:: + + $ make help + test - run developer tests + docs - build documentation + docs-live - autobuild HTML documentation while editing + run - run developer instance + install - developer install (./local) + uninstall - uninstall (./local) + gh-pages - build docs & deploy on gh-pages branch + clean - drop builds and environments + ... + +.. contents:: Contents + :depth: 2 + :local: + :backlinks: entry + + +.. _makefile setup: + +Setup +===== + +.. _git stash: https://git-scm.com/docs/git-stash + +The main setup is done in the :origin:`Makefile`:: + + export GIT_URL=https://github.com/asciimoo/searx + export SEARX_URL=https://searx.me + export DOCS_URL=https://asciimoo.github.io/searx + +.. sidebar:: fork & upstream + + Commit changes in your (local) branch, fork or whatever, but do not push them + upstream / `git stash`_ is your friend. + +:GIT_URL: Changes this, to point to your searx fork. + +:SEARX_URL: Changes this, to point to your searx instance. + +:DOCS_URL: If you host your own (branded) documentation, change this URL. + +.. _make pyenv: + +Python environment +================== + +.. sidebar:: activate environment + + ``source ./local/py3/bin/activate`` + +With Makefile we do no longer need to build up the virualenv manually (as +described in the :ref:`devquickstart` guide). Jump into your git working tree +and release a ``make pyenv``: + +.. code:: sh + + $ cd ~/searx-clone + $ make pyenv + PYENV usage: source ./local/py3/bin/activate + ... + +With target ``pyenv`` a development environment (aka virtualenv) was build up in +``./local/py3/``. To make a *developer install* of searx (:origin:`setup.py`) +into this environment, use make target ``install``: + +.. code:: sh + + $ make install + PYENV usage: source ./local/py3/bin/activate + PYENV using virtualenv from ./local/py3 + PYENV install . + +You have never to think about intermediate targets like ``pyenv`` or +``install``, the ``Makefile`` chains them as requisites. Just run your main +target. + +.. sidebar:: drop environment + + To get rid of the existing environment before re-build use :ref:`clean target + ` first. + +If you think, something goes wrong with your ./local environment or you change +the :origin:`setup.py` file (or the requirements listed in +:origin:`requirements-dev.txt` and :origin:`requirements.txt`), you have to call +:ref:`make clean`. + + +.. _make run: + +``make run`` +============ + +To get up a running a developer instance simply call ``make run``. This enables +*debug* option in :origin:`searx/settings.yml`, starts a ``./searx/webapp.py`` +instance, disables *debug* option again and opens the URL in your favorite WEB +browser (:man:`xdg-open`): + +.. code:: sh + + $ make run + PYENV usage: source ./local/py3/bin/activate + PYENV install . + ./local/py3/bin/python ./searx/webapp.py + ... + INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit) + ... + +.. _make clean: + +``make clean`` +============== + +Drop all intermediate files, all builds, but keep sources untouched. Includes +target ``pyclean`` which drops ./local environment. Before calling ``make +clean`` stop all processes using :ref:`make pyenv`. + +.. code:: sh + + $ make clean + CLEAN pyclean + CLEAN clean + +.. _make docs: + +``make docs docs-live docs-clean`` +================================== + +We describe the usage of the ``doc*`` targets in the :ref:`How to contribute / +Documentation ` section. If you want to edit the documentation +read our :ref:`make docs-live` section. If you are working in your own brand, +adjust your :ref:`Makefile setup `. + + +.. _make gh-pages: + +``make gh-pages`` +================= + +To deploy on github.io first adjust your :ref:`Makefile setup `. For any further read :ref:`deploy on github.io`. + +.. _make test: + +``make test`` +============= + +Runs a series of tests: ``test.pep8``, ``test.unit``, ``test.robot`` and does +additional :ref:`pylint checks `. You can run tests selective, +e.g.: + +.. code:: sh + + $ make test.pep8 test.unit + . ./local/py3/bin/activate; ./manage.sh pep8_check + [!] Running pep8 check + . ./local/py3/bin/activate; ./manage.sh unit_tests + [!] Running unit tests + +.. _make pylint: + +``make pylint`` +=============== + +.. _Pylint: https://www.pylint.org/ + +Before commiting its recommend to do some (more) linting. Pylint_ is known as +one of the best source-code, bug and quality checker for the Python programming +language. Pylint_ is not yet a quality gate within our searx project (like +:ref:`test.pep8 ` it is), but Pylint_ can help to improve code +quality anyway. The pylint profile we use at searx project is found in +project's root folder :origin:`.pylintrc`. + +Code quality is a ongoing process. Don't try to fix all messages from Pylint, +run Pylint and check if your changed lines are bringing up new messages. If so, +fix it. By this, code quality gets incremental better and if there comes the +day, the linting is balanced out, we might decide to add Pylint as a quality +gate. + + +``make pybuild`` +================ + +.. _PyPi: https://pypi.org/ +.. _twine: https://twine.readthedocs.io/en/latest/ + +Build Python packages in ``./dist/py``. + +.. code:: sh + + $ make pybuild + ... + BUILD pybuild + running sdist + running egg_info + ... + $ ls ./dist/py/ + searx-0.15.0-py3-none-any.whl searx-0.15.0.tar.gz + +To upload packages to PyPi_, there is also a ``upload-pypi`` target. It needs +twine_ to be installed. Since you are not the owner of :pypi:`searx` you will +never need the latter. diff --git a/docs/dev/plugins.rst b/docs/dev/plugins.rst new file mode 100644 index 000000000..2bf44f181 --- /dev/null +++ b/docs/dev/plugins.rst @@ -0,0 +1,54 @@ +.. _dev plugin: + +======= +Plugins +======= + +.. sidebar:: Further reading .. + + - :ref:`plugins generic` + +Plugins can extend or replace functionality of various components of searx. + +Example plugin +============== + +.. code:: python + + name = 'Example plugin' + description = 'This plugin extends the suggestions with the word "example"' + default_on = False # disabled by default + + js_dependencies = tuple() # optional, list of static js files + css_dependencies = tuple() # optional, list of static css files + + + # attach callback to the post search hook + # request: flask request object + # ctx: the whole local context of the post search hook + def post_search(request, ctx): + ctx['search'].suggestions.add('example') + return True + +Plugin entry points +=================== + +Entry points (hooks) define when a plugin runs. Right now only three hooks are +implemented. So feel free to implement a hook if it fits the behaviour of your +plugin. + +Pre search hook +--------------- + +Runs BEFORE the search request. Function to implement: ``pre_search`` + +Post search hook +---------------- + +Runs AFTER the search request. Function to implement: ``post_search`` + +Result hook +----------- + +Runs when a new result is added to the result list. Function to implement: +``on_result`` diff --git a/docs/dev/quickstart.rst b/docs/dev/quickstart.rst new file mode 100644 index 000000000..e40772b3b --- /dev/null +++ b/docs/dev/quickstart.rst @@ -0,0 +1,132 @@ +.. _devquickstart: + +====================== +Development Quickstart +====================== + +.. sidebar:: :ref:`makefile` + + For additional developer purpose there are :ref:`makefile`. + +This quickstart guide gets your environment set up with searx. Furthermore, it +gives a short introduction to the ``manage.sh`` script. + +How to setup your development environment +========================================= + +.. sidebar:: :ref:`make pyenv ` + + Alternatively use the :ref:`make pyenv`. + +First, clone the source code of searx to the desired folder. In this case the +source is cloned to ``~/myprojects/searx``. Then create and activate the +searx-ve virtualenv and install the required packages using ``manage.sh``. + +.. code:: sh + + cd ~/myprojects + git clone https://github.com/asciimoo/searx.git + cd searx + virtualenv searx-ve + . ./searx-ve/bin/activate + ./manage.sh update_dev_packages + + +How to run tests +================ + +.. sidebar:: :ref:`make test.unit ` + + Alternatively use the ``test.pep8``, ``test.unit``, ``test.robot`` targets. + +Tests can be run using the ``manage.sh`` script. Following tests and checks are +available: + +- Unit tests +- Selenium tests +- PEP8 validation +- Unit test coverage check + +For example unit tests are run with the command below: + +.. code:: sh + + ./manage.sh unit_tests + +For further test options, please consult the help of the ``manage.sh`` script or +read :ref:`make test`. + + +How to compile styles and javascript +==================================== + +.. _less: http://lesscss.org/ +.. _NodeJS: https://nodejs.org + +How to build styles +------------------- + +Less_ is required to build the styles of searx. Less_ can be installed using +either NodeJS_ or Apt. + +.. code:: sh + + sudo -H apt-get install nodejs + sudo -H npm install -g less + +OR + +.. code:: sh + + sudo -H apt-get install node-less + +After satisfying the requirements styles can be build using ``manage.sh`` + +.. code:: sh + + ./manage.sh styles + + +How to build the source of the oscar theme +========================================== + +.. _grunt: https://gruntjs.com/ + +Grunt_ must be installed in order to build the javascript sources. It depends on +NodeJS, so first Node has to be installed. + +.. code:: sh + + sudo -H apt-get install nodejs + sudo -H npm install -g grunt-cli + +After installing grunt, the files can be built using the following command: + +.. code:: sh + + ./manage.sh grunt_build + + +Tips for debugging/development +============================== + +.. sidebar:: :ref:`make run` + + Makefile target ``run`` already enables debug option for your developer + session / see :ref:`make run`. + +Turn on debug logging + Whether you are working on a new engine or trying to eliminate a bug, it is + always a good idea to turn on debug logging. When debug logging is enabled a + stack trace appears, instead of the cryptic ``Internal Server Error`` + message. It can be turned on by setting ``debug: False`` to ``debug: True`` in + :origin:`settings.yml `. + +.. sidebar:: :ref:`make test` + + Alternatively use the :ref:`make test` targets. + +Run ``./manage.sh tests`` before creating a PR. + Failing build on Travis is common because of PEP8 checks. So a new commit + must be created containing these format fixes. This phase can be skipped if + ``./manage.sh tests`` is run locally before creating a PR. diff --git a/docs/dev/reST.rst b/docs/dev/reST.rst new file mode 100644 index 000000000..4dc1279f0 --- /dev/null +++ b/docs/dev/reST.rst @@ -0,0 +1,1428 @@ +.. _reST primer: + +=========== +reST primer +=========== + +.. sidebar:: KISS_ and readability_ + + Instead of defining more and more roles, we at searx encourage our + contributors to follow principles like KISS_ and readability_. + +We at searx are using reStructuredText (aka reST_) markup for all kind of +documentation, with the builders from the Sphinx_ project a HTML output is +generated and deployed at :docs:`github.io <.>`. For build prerequisites read +:ref:`docs build`. + +The source files of Searx's documentation are located at :origin:`docs`. Sphinx +assumes source files to be encoded in UTF-8 by defaul. Run :ref:`make docs-live +` to build HTML while editing. + +.. sidebar:: Further reading + + - Sphinx-Primer_ + - `Sphinx markup constructs`_ + - reST_, docutils_, `docutils FAQ`_ + - Sphinx_, `sphinx-doc FAQ`_ + - `sphinx config`_, doctree_ + - `sphinx cross references`_ + - linuxdoc_ + - intersphinx_ + - sphinx-jinja_ + - `Sphinx's autodoc`_ + - `Sphinx's Python domain`_, `Sphinx's C domain`_ + - SVG_, ImageMagick_ + - DOT_, `Graphviz's dot`_, Graphviz_ + + +.. contents:: Contents + :depth: 3 + :local: + :backlinks: entry + +Sphinx_ and reST_ have their place in the python ecosystem. Over that reST is +used in popular projects, e.g the Linux kernel documentation `[kernel doc]`_. + +.. _[kernel doc]: https://www.kernel.org/doc/html/latest/doc-guide/sphinx.html + +.. sidebar:: Content matters + + The readability_ of the reST sources has its value, therefore we recommend to + make sparse usage of reST markup / .. content matters! + +**reST** is a plaintext markup language, its markup is *mostly* intuitive and +you will not need to learn much to produce well formed articles with. I use the +word *mostly*: like everything in live, reST has its advantages and +disadvantages, some markups feel a bit grumpy (especially if you are used to +other plaintext markups). + +Soft skills +=========== + +Before going any deeper into the markup let's face on some **soft skills** a +trained author brings with, to reach a well feedback from readers: + +- Documentation is dedicated to an audience and answers questions from the + audience point of view. +- Don't detail things which are general knowledge from the audience point of + view. +- Limit the subject, use cross links for any further reading. + +To be more concrete what a *point of view* means. In the (:origin:`docs`) +folder we have three sections (and the *blog* folder), each dedicate to a +different group of audience. + +User's POV: :origin:`docs/user` + A typical user knows about search engines and might have heard about + meta crawlers and privacy. + +Admin's POV: :origin:`docs/admin` + A typical Admin knows about setting up services on a linux system, but he does + not know all the pros and cons of a searx setup. + +Developer's POV: :origin:`docs/dev` + Depending on the readability_ of code, a typical developer is able to read and + understand source code. Describe what a item aims to do (e.g. a function). + If the chronological order matters, describe it. Name the *out-of-limits + conditions* and all the side effects a external developer will not know. + +.. _reST inline markup: + +Basic inline markup +=================== + +.. sidebar:: Inline markup + + - :ref:`reST roles` + - :ref:`reST smart ref` + +Basic inline markup is done with asterisks and backquotes. If asterisks or +backquotes appear in running text and could be confused with inline markup +delimiters, they have to be escaped with a backslash (``\*pointer``). + +.. table:: basic inline markup + :widths: 4 3 7 + + ================================================ ==================== ======================== + description rendered markup + ================================================ ==================== ======================== + one asterisk for emphasis *italics* ``*italics*`` + two asterisks for strong emphasis **boldface** ``**boldface**`` + backquotes for code samples and literals ``foo()`` ````foo()```` + quote asterisks or backquotes \*foo is a pointer ``\*foo is a pointer`` + ================================================ ==================== ======================== + +.. _reST basic structure: + +Basic article structure +======================= + +The basic structure of an article makes use of heading adornments to markup +chapter, sections and subsections. + +.. _reST template: + +reST template +------------- + +reST template for an simple article: + +.. code:: reST + + .. _doc refname: + + ============== + Document title + ============== + + Lorem ipsum dolor sit amet, consectetur adipisici elit .. Further read + :ref:`chapter refname`. + + .. _chapter refname: + + Chapter + ======= + + Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquid ex ea commodi consequat ... + + .. _section refname: + + Section + ------- + + lorem .. + + .. _subsection refname: + + Subsection + ~~~~~~~~~~ + + lorem .. + + +Headings +-------- + +#. title - with overline for document title: + + .. code:: reST + + ============== + Document title + ============== + + +#. chapter - with anchor named ``anchor name``: + + .. code:: reST + + .. _anchor name: + + Chapter + ======= + +#. section + + .. code:: reST + + Section + ------- + +#. subsection + + .. code:: reST + + Subsection + ~~~~~~~~~~ + + + +Anchors & Links +=============== + +.. _reST anchor: + +Anchors +------- + +.. _ref role: + https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-ref + +To refer a point in the documentation a anchor is needed. The :ref:`reST +template ` shows an example where a chapter titled *"Chapters"* +gets an anchor named ``chapter title``. Another example from *this* document, +where the anchor named ``reST anchor``: + +.. code:: reST + + .. _reST anchor: + + Anchors + ------- + + To refer a point in the documentation a anchor is needed ... + +To refer anchors use the `ref role`_ markup: + +.. code:: reST + + Visit chapter :ref:`reST anchor`. Or set hyperlink text manualy :ref:`foo + bar `. + +.. admonition:: ``:ref:`` role + :class: rst-example + + Visist chapter :ref:`reST anchor`. Or set hyperlink text manualy :ref:`foo + bar `. + +.. _reST ordinary ref: + +Link ordinary URL +----------------- + +If you need to reference external URLs use *named* hyperlinks to maintain +readability of reST sources. Here is a example taken from *this* article: + +.. code:: reST + + .. _Sphinx Field Lists: + https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html + + With the *named* hyperlink `Sphinx Field Lists`_, the raw text is much more + readable. + + And this shows the alternative (less readable) hyperlink markup `Sphinx Field + Lists + `__. + +.. admonition:: Named hyperlink + :class: rst-example + + With the *named* hyperlink `Sphinx Field Lists`_, the raw text is much more + readable. + + And this shows the alternative (less readable) hyperlink markup `Sphinx Field + Lists + `__. + + +.. _reST smart ref: + +Smart refs +---------- + +With the power of sphinx.ext.extlinks_ and intersphinx_ referencing external +content becomes smart. + +.. table:: smart refs with sphinx.ext.extlinks_ and intersphinx_ + :widths: 4 3 7 + + ========================== ================================== ==================================== + refer ... rendered example markup + ========================== ================================== ==================================== + :rst:role:`rfc` :rfc:`822` ``:rfc:`822``` + :rst:role:`pep` :pep:`8` ``:pep:`8``` + sphinx.ext.extlinks_ + -------------------------------------------------------------------------------------------------- + project's wiki article :wiki:`Searx-instances` ``:wiki:`Searx-instances``` + to docs public URL :docs:`dev/reST.html` ``:docs:`dev/reST.html``` + files & folders origin :origin:`docs/dev/reST.rst` ``:origin:`docs/dev/reST.rst``` + pull request :pull:`1756` ``:pull:`1756``` + patch :patch:`af2cae6` ``:patch:`af2cae6``` + PyPi package :pypi:`searx` ``:pypi:`searx``` + manual page man :man:`bash` ``:man:`bash``` + intersphinx_ + -------------------------------------------------------------------------------------------------- + external anchor :ref:`python:and` ``:ref:`python:and``` + external doc anchor :doc:`jinja:templates` ``:doc:`jinja:templates``` + python code object :py:obj:`datetime.datetime` ``:py:obj:`datetime.datetime``` + flask code object :py:obj:`flask.Flask` ``:py:obj:`flask.Flask``` + ========================== ================================== ==================================== + + +Intersphinx is configured in :origin:`docs/conf.py`: + +.. code:: python + + intersphinx_mapping = { + "python": ("https://docs.python.org/3/", None), + "flask": ("https://flask.palletsprojects.com/", None), + "jinja": ("https://jinja.palletsprojects.com/", None), + "linuxdoc" : ("https://return42.github.io/linuxdoc/", None), + "sphinx" : ("https://www.sphinx-doc.org/en/master/", None), + } + + +To list all anchors of the inventory (e.g. ``python``) use: + +.. code:: sh + + $ python -m sphinx.ext.intersphinx https://docs.python.org/3/objects.inv + +Literal blocks +============== + +The simplest form of :duref:`literal-blocks` is a indented block introduced by +two colons (``::``). For highlighting use :dudir:`highlight` or :ref:`reST +code` directive. To include literals from external files use directive +:dudir:`literalinclude`. + +.. _reST literal: + +``::`` +------ + +.. code:: reST + + :: + + Literal block + + Lorem ipsum dolor:: + + Literal block + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy + eirmod tempor invidunt ut labore :: + + Literal block + +.. admonition:: Literal block + :class: rst-example + + :: + + Literal block + + Lorem ipsum dolor:: + + Literal block + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy + eirmod tempor invidunt ut labore :: + + Literal block + + +.. _reST code: + +``code-block`` +-------------- + +.. _pygments: https://pygments.org/languages/ + +.. sidebar:: Syntax highlighting + + is handled by pygments_. + +The :rst:dir:`code-block` directive is a variant of the :dudir:`code` directive +with additional options. To learn more about code literals visit +:ref:`sphinx:code-examples`. + +.. code-block:: reST + + The URL ``/stats`` handle is shown in :ref:`stats-handle` + + .. code-block:: Python + :caption: python code block + :name: stats-handle + + @app.route('/stats', methods=['GET']) + def stats(): + """Render engine statistics page.""" + stats = get_engines_stats() + return render( + 'stats.html' + , stats = stats ) + +.. code-block:: reST + +.. admonition:: Code block + :class: rst-example + + The URL ``/stats`` handle is shown in :ref:`stats-handle` + + .. code-block:: Python + :caption: python code block + :name: stats-handle + + @app.route('/stats', methods=['GET']) + def stats(): + """Render engine statistics page.""" + stats = get_engines_stats() + return render( + 'stats.html' + , stats = stats ) + +Unicode substitution +==================== + +The :dudir:`unicode directive ` converts Unicode +character codes (numerical values) to characters. This directive can only be +used within a substitution definition. + +.. code-block:: reST + + .. |copy| unicode:: 0xA9 .. copyright sign + .. |(TM)| unicode:: U+2122 + + Trademark |(TM)| and copyright |copy| glyphs. + +.. admonition:: Unicode + :class: rst-example + + .. |copy| unicode:: 0xA9 .. copyright sign + .. |(TM)| unicode:: U+2122 + + Trademark |(TM)| and copyright |copy| glyphs. + + +.. _reST roles: + +Roles +===== + +.. sidebar:: Further reading + + - `Sphinx Roles`_ + - :doc:`sphinx:usage/restructuredtext/domains` + + +A *custom interpreted text role* (:duref:`ref `) is an inline piece of +explicit markup. It signifies that that the enclosed text should be interpreted +in a specific way. + +The general markup is one of: + +.. code:: reST + + :rolename:`ref-name` + :rolename:`ref text ` + +.. table:: smart refs with sphinx.ext.extlinks_ and intersphinx_ + :widths: 4 3 7 + + ========================== ================================== ==================================== + role rendered example markup + ========================== ================================== ==================================== + :rst:role:`guilabel` :guilabel:`&Cancel` ``:guilabel:`&Cancel``` + :rst:role:`kbd` :kbd:`C-x C-f` ``:kbd:`C-x C-f``` + :rst:role:`menuselection` :menuselection:`Open --> File` ``:menuselection:`Open --> File``` + :rst:role:`download` :download:`this file ` ``:download:`this file ``` + math_ :math:`a^2 + b^2 = c^2` ``:math:`a^2 + b^2 = c^2``` + :rst:role:`ref` :ref:`svg image example` ``:ref:`svg image example``` + :rst:role:`command` :command:`ls -la` ``:command:`ls -la``` + :durole:`emphasis` :emphasis:`italic` ``:emphasis:`italic``` + :durole:`strong` :strong:`bold` ``:strong:`bold``` + :durole:`literal` :literal:`foo()` ``:literal:`foo()``` + :durole:`subscript` H\ :sub:`2`\ O ``H\ :sub:`2`\ O`` + :durole:`superscript` E = mc\ :sup:`2` ``E = mc\ :sup:`2``` + :durole:`title-reference` :title:`Time` ``:title:`Time``` + ========================== ================================== ==================================== + +Figures & Images +================ + +.. sidebar:: Image processing + + With the directives from :ref:`linuxdoc ` the build process + is flexible. To get best results in the generated output format, install + ImageMagick_ and Graphviz_. + +Searx's sphinx setup includes: :ref:`linuxdoc:kfigure`. Scaleable here means; +scaleable in sense of the build process. Normally in absence of a converter +tool, the build process will break. From the authors POV it’s annoying to care +about the build process when handling with images, especially since he has no +access to the build process. With :ref:`linuxdoc:kfigure` the build process +continues and scales output quality in dependence of installed image processors. + +If you want to add an image, you should use the ``kernel-figure`` (inheritance +of :dudir:`figure`) and ``kernel-image`` (inheritance of :dudir:`image`) +directives. E.g. to insert a figure with a scaleable image format use SVG +(:ref:`svg image example`): + +.. code:: reST + + .. _svg image example: + + .. kernel-figure:: svg_image.svg + :alt: SVG image example + + Simple SVG image + + To refer the figure, a caption block is needed: :ref:`svg image example`. + +.. _svg image example: + +.. kernel-figure:: svg_image.svg + :alt: SVG image example + + Simple SVG image. + +To refer the figure, a caption block is needed: :ref:`svg image example`. + +DOT files (aka Graphviz) +------------------------ + +With :ref:`linuxdoc:kernel-figure` reST support for **DOT** formatted files is +given. + +- `Graphviz's dot`_ +- DOT_ +- Graphviz_ + +A simple example is shown in :ref:`dot file example`: + +.. code:: reST + + .. _dot file example: + + .. kernel-figure:: hello.dot + :alt: hello world + + DOT's hello world example + +.. admonition:: hello.dot + :class: rst-example + + .. _dot file example: + + .. kernel-figure:: hello.dot + :alt: hello world + + DOT's hello world example + +``kernel-render`` DOT +--------------------- + +Embed *render* markups (or languages) like Graphviz's **DOT** is provided by the +:ref:`linuxdoc:kernel-render` directive. A simple example of embedded DOT_ is +shown in figure :ref:`dot render example`: + +.. code:: reST + + .. _dot render example: + + .. kernel-render:: DOT + :alt: digraph + :caption: Embedded DOT (Graphviz) code + + digraph foo { + "bar" -> "baz"; + } + + Attribute ``caption`` is needed, if you want to refer the figure: :ref:`dot + render example`. + +Please note :ref:`build tools `. If Graphviz_ is +installed, you will see an vector image. If not, the raw markup is inserted as +*literal-block*. + +.. admonition:: kernel-render DOT + :class: rst-example + + .. _dot render example: + + .. kernel-render:: DOT + :alt: digraph + :caption: Embedded DOT (Graphviz) code + + digraph foo { + "bar" -> "baz"; + } + + Attribute ``caption`` is needed, if you want to refer the figure: :ref:`dot + render example`. + +``kernel-render`` SVG +--------------------- + +A simple example of embedded SVG_ is shown in figure :ref:`svg render example`: + +.. code:: reST + + .. _svg render example: + + .. kernel-render:: SVG + :caption: Embedded **SVG** markup + :alt: so-nw-arrow +.. + + .. code:: xml + + + + + + + +.. admonition:: kernel-render SVG + :class: rst-example + + .. _svg render example: + + .. kernel-render:: SVG + :caption: Embedded **SVG** markup + :alt: so-nw-arrow + + + + + + + + + + +.. _reST lists: + +List markups +============ + +Bullet list +----------- + +List markup (:duref:`ref `) is simple: + +.. code:: reST + + - This is a bulleted list. + + 1. Nested lists are possible, but be aware that they must be separated from + the parent list items by blank line + 2. Second item of nested list + + - It has two items, the second + item uses two lines. + + #. This is a numbered list. + #. It has two items too. + +.. admonition:: bullet list + :class: rst-example + + - This is a bulleted list. + + 1. Nested lists are possible, but be aware that they must be separated from + the parent list items by blank line + 2. Second item of nested list + + - It has two items, the second + item uses two lines. + + #. This is a numbered list. + #. It has two items too. + + +Horizontal list +--------------- + +The :rst:dir:`.. hlist:: ` transforms a bullet list into a more compact +list. + +.. code:: reST + + .. hlist:: + + - first list item + - second list item + - third list item + ... + +.. admonition:: hlist + :class: rst-example + + .. hlist:: + + - first list item + - second list item + - third list item + - next list item + - next list item xxxx + - next list item yyyy + - next list item zzzz + + +Definition list +--------------- + +.. sidebar:: Note .. + + - the term cannot have more than one line of text + + - there is **no blank line between term and definition block** // this + distinguishes definition lists (:duref:`ref `) from block + quotes (:duref:`ref `). + +Each definition list (:duref:`ref `) item contains a term, +optional classifiers and a definition. A term is a simple one-line word or +phrase. Optional classifiers may follow the term on the same line, each after +an inline ' : ' (**space, colon, space**). A definition is a block indented +relative to the term, and may contain multiple paragraphs and other body +elements. There may be no blank line between a term line and a definition block +(*this distinguishes definition lists from block quotes*). Blank lines are +required before the first and after the last definition list item, but are +optional in-between. + +Definition lists are created as follows: + +.. code:: reST + + term 1 (up to a line of text) + Definition 1. + + See the typo : this line is not a term! + + And this is not term's definition. **There is a blank line** in between + the line above and this paragraph. That's why this paragraph is taken as + **block quote** (:duref:`ref `) and not as term's definition! + + term 2 + Definition 2, paragraph 1. + + Definition 2, paragraph 2. + + term 3 : classifier + Definition 3. + + term 4 : classifier one : classifier two + Definition 4. + +.. admonition:: definition list + :class: rst-example + + term 1 (up to a line of text) + Definition 1. + + See the typo : this line is not a term! + + And this is not term's definition. **There is a blank line** in between + the line above and this paragraph. That's why this paragraph is taken as + **block quote** (:duref:`ref `) and not as term's definition! + + + term 2 + Definition 2, paragraph 1. + + Definition 2, paragraph 2. + + term 3 : classifier + Definition 3. + + term 4 : classifier one : classifier two + + +Quoted paragraphs +----------------- + +Quoted paragraphs (:duref:`ref `) are created by just indenting +them more than the surrounding paragraphs. Line blocks (:duref:`ref +`) are a way of preserving line breaks: + +.. code:: reST + + normal paragraph ... + lorem ipsum. + + Quoted paragraph ... + lorem ipsum. + + | These lines are + | broken exactly like in + | the source file. + + +.. admonition:: Quoted paragraph and line block + :class: rst-example + + normal paragraph ... + lorem ipsum. + + Quoted paragraph ... + lorem ipsum. + + | These lines are + | broken exactly like in + | the source file. + + +.. _reST field list: + +Field Lists +----------- + +.. _Sphinx Field Lists: + https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html + +.. sidebar:: bibliographic fields + + First lines fields are bibliographic fields, see `Sphinx Field Lists`_. + +Field lists are used as part of an extension syntax, such as options for +directives, or database-like records meant for further processing. Field lists +are mappings from field names to field bodies. They marked up like this: + +.. code:: reST + + :fieldname: Field content + :foo: first paragraph in field foo + + second paragraph in field foo + + :bar: Field content + +.. admonition:: Field List + :class: rst-example + + :fieldname: Field content + :foo: first paragraph in field foo + + second paragraph in field foo + + :bar: Field content + + +They are commonly used in Python documentation: + +.. code:: python + + def my_function(my_arg, my_other_arg): + """A function just for me. + + :param my_arg: The first of my arguments. + :param my_other_arg: The second of my arguments. + + :returns: A message (just for me, of course). + """ + +Further list blocks +------------------- + +- field lists (:duref:`ref `, with caveats noted in + :ref:`reST field list`) +- option lists (:duref:`ref `) +- quoted literal blocks (:duref:`ref `) +- doctest blocks (:duref:`ref `) + + +Admonitions +=========== + +Sidebar +------- + +Sidebar is an eye catcher, often used for admonitions pointing further stuff or +site effects. Here is the source of the sidebar :ref:`on top of this page `. + +.. code:: reST + + .. sidebar:: KISS_ and readability_ + + Instead of defining more and more roles, we at searx encourage our + contributors to follow principles like KISS_ and readability_. + +Generic admonition +------------------ + +The generic :dudir:`admonition ` needs a title: + +.. code:: reST + + .. admonition:: generic admonition title + + lorem ipsum .. + + +.. admonition:: generic admonition title + + lorem ipsum .. + + +Specific admonitions +-------------------- + +Specific admonitions: :dudir:`hint`, :dudir:`note`, :dudir:`tip` :dudir:`attention`, +:dudir:`caution`, :dudir:`danger`, :dudir:`error`, , :dudir:`important`, and +:dudir:`warning` . + +.. code:: reST + + .. hint:: + + lorem ipsum .. + + .. note:: + + lorem ipsum .. + + .. warning:: + + lorem ipsum .. + + +.. hint:: + + lorem ipsum .. + +.. note:: + + lorem ipsum .. + +.. tip:: + + lorem ipsum .. + +.. attention:: + + lorem ipsum .. + +.. caution:: + + lorem ipsum .. + +.. danger:: + + lorem ipsum .. + +.. important:: + + lorem ipsum .. + +.. error:: + + lorem ipsum .. + +.. warning:: + + lorem ipsum .. + + +Tables +====== + +.. sidebar:: Nested tables + + Nested tables are ugly! Not all builder support nested tables, don't use + them! + +ASCII-art tables like :ref:`reST simple table` and :ref:`reST grid table` might +be comfortable for readers of the text-files, but they have huge disadvantages +in the creation and modifying. First, they are hard to edit. Think about +adding a row or a column to a ASCII-art table or adding a paragraph in a cell, +it is a nightmare on big tables. + + +.. sidebar:: List tables + + For meaningful patch and diff use :ref:`reST flat table`. + +Second the diff of modifying ASCII-art tables is not meaningful, e.g. widening a +cell generates a diff in which also changes are included, which are only +ascribable to the ASCII-art. Anyway, if you prefer ASCII-art for any reason, +here are some helpers: + +* `Emacs Table Mode`_ +* `Online Tables Generator`_ + +.. _reST simple table: + +Simple tables +------------- + +:duref:`Simple tables ` allow *colspan* but not *rowspan*. If +your table need some metadata (e.g. a title) you need to add the ``.. table:: +directive`` :dudir:`(ref) ` in front and place the table in its body: + +.. code:: reST + + .. table:: foo gate truth table + :widths: grid + :align: left + + ====== ====== ====== + Inputs Output + ------------- ------ + A B A or B + ====== ====== ====== + False + -------------------- + True + -------------------- + True False True + (foo) + ------ ------ ------ + False True + (foo) + ====== ============= + +.. admonition:: Simple ASCII table + :class: rst-example + + .. table:: foo gate truth table + :widths: grid + :align: left + + ====== ====== ====== + Inputs Output + ------------- ------ + A B A or B + ====== ====== ====== + False + -------------------- + True + -------------------- + True False True + (foo) + ------ ------ ------ + False True + (foo) + ====== ============= + + + +.. _reST grid table: + +Grid tables +----------- + +:duref:`Grid tables ` allow colspan *colspan* and *rowspan*: + +.. code:: reST + + .. table:: grid table example + :widths: 1 1 5 + + +------------+------------+-----------+ + | Header 1 | Header 2 | Header 3 | + +============+============+===========+ + | body row 1 | column 2 | column 3 | + +------------+------------+-----------+ + | body row 2 | Cells may span columns.| + +------------+------------+-----------+ + | body row 3 | Cells may | - Cells | + +------------+ span rows. | - contain | + | body row 4 | | - blocks. | + +------------+------------+-----------+ + +.. admonition:: ASCII grid table + :class: rst-example + + .. table:: grid table example + :widths: 1 1 5 + + +------------+------------+-----------+ + | Header 1 | Header 2 | Header 3 | + +============+============+===========+ + | body row 1 | column 2 | column 3 | + +------------+------------+-----------+ + | body row 2 | Cells may span columns.| + +------------+------------+-----------+ + | body row 3 | Cells may | - Cells | + +------------+ span rows. | - contain | + | body row 4 | | - blocks. | + +------------+------------+-----------+ + + +.. _reST flat table: + +flat-table +---------- + +The ``flat-table`` is a further developed variant of the :ref:`list tables +`. It is a double-stage list similar to the +:dudir:`list-table` with some additional features: + +column-span: ``cspan`` + with the role ``cspan`` a cell can be extended through additional columns + +row-span: ``rspan`` + with the role ``rspan`` a cell can be extended through additional rows + +auto-span: + spans rightmost cell of a table row over the missing cells on the right side + of that table-row. With Option ``:fill-cells:`` this behavior can changed + from *auto span* to *auto fill*, which automatically inserts (empty) cells + instead of spanning the last cell. + +options: + :header-rows: [int] count of header rows + :stub-columns: [int] count of stub columns + :widths: [[int] [int] ... ] widths of columns + :fill-cells: instead of auto-span missing cells, insert missing cells + +roles: + :cspan: [int] additional columns (*morecols*) + :rspan: [int] additional rows (*morerows*) + +The example below shows how to use this markup. The first level of the staged +list is the *table-row*. In the *table-row* there is only one markup allowed, +the list of the cells in this *table-row*. Exception are *comments* ( ``..`` ) +and *targets* (e.g. a ref to :ref:`row 2 of table's body `). + +.. code:: reST + + .. flat-table:: ``flat-table`` example + :header-rows: 2 + :stub-columns: 1 + :widths: 1 1 1 1 2 + + * - :rspan:`1` head / stub + - :cspan:`3` head 1.1-4 + + * - head 2.1 + - head 2.2 + - head 2.3 + - head 2.4 + + * .. row body 1 / this is a comment + + - row 1 + - :rspan:`2` cell 1-3.1 + - cell 1.2 + - cell 1.3 + - cell 1.4 + + * .. Comments and targets are allowed on *table-row* stage. + .. _`row body 2`: + + - row 2 + - cell 2.2 + - :rspan:`1` :cspan:`1` + cell 2.3 with a span over + + * col 3-4 & + * row 2-3 + + * - row 3 + - cell 3.2 + + * - row 4 + - cell 4.1 + - cell 4.2 + - cell 4.3 + - cell 4.4 + + * - row 5 + - cell 5.1 with automatic span to rigth end + + * - row 6 + - cell 6.1 + - .. + + +.. admonition:: List table + :class: rst-example + + .. flat-table:: ``flat-table`` example + :header-rows: 2 + :stub-columns: 1 + :widths: 1 1 1 1 2 + + * - :rspan:`1` head / stub + - :cspan:`3` head 1.1-4 + + * - head 2.1 + - head 2.2 + - head 2.3 + - head 2.4 + + * .. row body 1 / this is a comment + + - row 1 + - :rspan:`2` cell 1-3.1 + - cell 1.2 + - cell 1.3 + - cell 1.4 + + * .. Comments and targets are allowed on *table-row* stage. + .. _`row body 2`: + + - row 2 + - cell 2.2 + - :rspan:`1` :cspan:`1` + cell 2.3 with a span over + + * col 3-4 & + * row 2-3 + + * - row 3 + - cell 3.2 + + * - row 4 + - cell 4.1 + - cell 4.2 + - cell 4.3 + - cell 4.4 + + * - row 5 + - cell 5.1 with automatic span to rigth end + + * - row 6 + - cell 6.1 + - .. + + +CSV table +--------- + +CSV table might be the choice if you want to include CSV-data from a outstanding +(build) process into your documentation. + +.. code:: reST + + .. csv-table:: CSV table example + :header: .. , Column 1, Column 2 + :widths: 2 5 5 + :stub-columns: 1 + :file: csv_table.txt + +Content of file ``csv_table.txt``: + +.. literalinclude:: csv_table.txt + +.. admonition:: CSV table + :class: rst-example + + .. csv-table:: CSV table example + :header: .. , Column 1, Column 2 + :widths: 3 5 5 + :stub-columns: 1 + :file: csv_table.txt + +Templating +========== + +.. sidebar:: Build environment + + All *generic-doc* tasks are running in the :ref:`build environment `. + +Templating is suitable for documentation which is created generic at the build +time. The sphinx-jinja_ extension evaluates jinja_ templates in the :ref:`build +environment ` (with searx modules installed). We use this e.g. to +build chapter: :ref:`engines generic`. Below the jinja directive from the +:origin:`docs/admin/engines.rst` is shown: + +.. literalinclude:: ../admin/engines.rst + :language: reST + :start-after: .. _configured engines: + +The context for the template is selected in the line ``.. jinja:: webapp``. In +sphinx's build configuration (:origin:`docs/conf.py`) the ``webapp`` context +points to the name space of the python module: ``webapp``. + +.. code:: py + + from searx import webapp + jinja_contexts = { + 'webapp': dict(**webapp.__dict__) + } + + +Tabbed views +============ + +.. _sphinx-tabs: https://github.com/djungelorm/sphinx-tabs +.. _basic-tabs: https://github.com/djungelorm/sphinx-tabs#basic-tabs +.. _group-tabs: https://github.com/djungelorm/sphinx-tabs#group-tabs +.. _code-tabs: https://github.com/djungelorm/sphinx-tabs#code-tabs + +With `sphinx-tabs`_ extension we have *tabbed views*. To provide installation +instructions with one tab per distribution we use the `group-tabs`_ directive, +others are basic-tabs_ and code-tabs_. Below a *group-tab* example from +:ref:`docs build` is shown: + +.. literalinclude:: ../admin/buildhosts.rst + :language: reST + :start-after: .. _system requirements: + :end-before: .. _system requirements END: + + +.. _math: + +Math equations +============== + +.. _Mathematics: https://en.wikibooks.org/wiki/LaTeX/Mathematics +.. _amsmath user guide: + http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/macros/latex/required/amsmath/amsldoc.pdf + +.. sidebar:: About LaTeX + + - `amsmath user guide`_ + - Mathematics_ + - :ref:`docs build` + +The input language for mathematics is LaTeX markup using the :ctan:`amsmath` +package. + +To embed LaTeX markup in reST documents, use role :rst:role:`:math: ` for +inline and directive :rst:dir:`.. math:: ` for block markup. + +.. code:: reST + + In :math:numref:`schroedinger general` the time-dependent Schrödinger equation + is shown. + + .. math:: + :label: schroedinger general + + \mathrm{i}\hbar\dfrac{\partial}{\partial t} |\,\psi (t) \rangle = + \hat{H} |\,\psi (t) \rangle. + +.. admonition:: LaTeX math equation + :class: rst-example + + In :math:numref:`schroedinger general` the time-dependent Schrödinger equation + is shown. + + .. math:: + :label: schroedinger general + + \mathrm{i}\hbar\dfrac{\partial}{\partial t} |\,\psi (t) \rangle = + \hat{H} |\,\psi (t) \rangle. + + +The next example shows the difference of ``\tfrac`` (*textstyle*) and ``\dfrac`` +(*displaystyle*) used in a inline markup or another fraction. + +.. code:: reST + + ``\tfrac`` **inline example** :math:`\tfrac{\tfrac{1}{x}+\tfrac{1}{y}}{y-z}` + ``\dfrac`` **inline example** :math:`\dfrac{\dfrac{1}{x}+\dfrac{1}{y}}{y-z}` + +.. admonition:: Line spacing + :class: rst-example + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy + eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam + voluptua. ... + ``\tfrac`` **inline example** :math:`\tfrac{\tfrac{1}{x}+\tfrac{1}{y}}{y-z}` + At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd + gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy + eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam + voluptua. ... + ``\tfrac`` **inline example** :math:`\dfrac{\dfrac{1}{x}+\dfrac{1}{y}}{y-z}` + At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd + gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + + +.. _KISS: https://en.wikipedia.org/wiki/KISS_principle + +.. _readability: https://docs.python-guide.org/writing/style/ +.. _Sphinx-Primer: + http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html +.. _reST: https://docutils.sourceforge.io/rst.html +.. _Sphinx Roles: + https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html +.. _Sphinx: http://www.sphinx-doc.org +.. _`sphinx-doc FAQ`: http://www.sphinx-doc.org/en/stable/faq.html +.. _Sphinx markup constructs: + http://www.sphinx-doc.org/en/stable/markup/index.html +.. _`sphinx cross references`: + http://www.sphinx-doc.org/en/stable/markup/inline.html#cross-referencing-arbitrary-locations +.. _sphinx.ext.extlinks: + https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html +.. _intersphinx: http://www.sphinx-doc.org/en/stable/ext/intersphinx.html +.. _sphinx config: http://www.sphinx-doc.org/en/stable/config.html +.. _Sphinx's autodoc: http://www.sphinx-doc.org/en/stable/ext/autodoc.html +.. _Sphinx's Python domain: + http://www.sphinx-doc.org/en/stable/domains.html#the-python-domain +.. _Sphinx's C domain: + http://www.sphinx-doc.org/en/stable/domains.html#cross-referencing-c-constructs +.. _doctree: + http://www.sphinx-doc.org/en/master/extdev/tutorial.html?highlight=doctree#build-phases +.. _docutils: http://docutils.sourceforge.net/docs/index.html +.. _docutils FAQ: http://docutils.sourceforge.net/FAQ.html +.. _linuxdoc: https://return42.github.io/linuxdoc +.. _jinja: https://jinja.palletsprojects.com/ +.. _sphinx-jinja: https://github.com/tardyp/sphinx-jinja +.. _SVG: https://www.w3.org/TR/SVG11/expanded-toc.html +.. _DOT: https://graphviz.gitlab.io/_pages/doc/info/lang.html +.. _`Graphviz's dot`: https://graphviz.gitlab.io/_pages/pdf/dotguide.pdf +.. _Graphviz: https://graphviz.gitlab.io +.. _ImageMagick: https://www.imagemagick.org + +.. _`Emacs Table Mode`: https://www.emacswiki.org/emacs/TableMode +.. _`Online Tables Generator`: http://www.tablesgenerator.com/text_tables +.. _`OASIS XML Exchange Table Model`: https://www.oasis-open.org/specs/tm9901.html diff --git a/docs/dev/search_api.rst b/docs/dev/search_api.rst new file mode 100644 index 000000000..922548ffb --- /dev/null +++ b/docs/dev/search_api.rst @@ -0,0 +1,120 @@ +.. _search API: + +========== +Search API +========== + +The search supports both ``GET`` and ``POST``. + +Furthermore, two enpoints ``/`` and ``/search`` are available for querying. + + +``GET /`` + +``GET /search`` + +Parameters +========== + +.. sidebar:: Further reading .. + + - :ref:`engines-dev` + - :ref:`settings.yml` + - :ref:`engines generic` + +``q`` : required + The search query. This string is passed to external search services. Thus, + searx supports syntax of each search service. For example, ``site:github.com + searx`` is a valid query for Google. However, if simply the query above is + passed to any search engine which does not filter its results based on this + syntax, you might not get the results you wanted. + + See more at :ref:`search-syntax` + +``categories`` : optional + Comma separated list, specifies the active search categories + +``engines`` : optional + Comma separated list, specifies the active search engines. + +``lang`` : default ``all`` + Code of the language. + +``pageno`` : default ``1`` + Search page number. + +``time_range`` : optional + [ ``day``, ``month``, ``year`` ] + + Time range of search for engines which support it. See if an engine supports + time range search in the preferences page of an instance. + +``format`` : optional + [ ``json``, ``csv``, ``rss`` ] + + Output format of results. + +``results_on_new_tab`` : default ``0`` + [ ``0``, ``1`` ] + + Open search results on new tab. + +``image_proxy`` : default ``False`` + [ ``True``, ``False`` ] + + Proxy image results through searx. + +``autocomplete`` : default *empty* + [ ``google``, ``dbpedia``, ``duckduckgo``, ``startpage``, ``wikipedia`` ] + + Service which completes words as you type. + +``safesearch`` : default ``None`` + [ ``0``, ``1``, ``None`` ] + + Filter search results of engines which support safe search. See if an engine + supports safe search in the preferences page of an instance. + +``theme`` : default ``oscar`` + [ ``oscar``, ``simple``, ``legacy``, ``pix-art``, ``courgette`` ] + + Theme of instance. + + Please note, available themes depend on an instance. It is possible that an + instance administrator deleted, created or renamed themes on his/her instance. + See the available options in the preferences page of the instance. + +``oscar-style`` : default ``logicodev`` + [ ``pointhi``, ``logicodev`` ] + + Style of Oscar theme. It is only parsed if the theme of an instance is + ``oscar``. + + Please note, available styles depend on an instance. It is possible that an + instance administrator deleted, created or renamed styles on his/her + instance. See the available options in the preferences page of the instance. + +``enabled_plugins`` : optional + List of enabled plugins. + + :default: ``HTTPS_rewrite``, ``Self_Informations``, + ``Search_on_category_select``, ``Tracker_URL_remover`` + + :values: [ ``DOAI_rewrite``, ``HTTPS_rewrite``, ``Infinite_scroll``, + ``Vim-like_hotkeys``, ``Self_Informations``, ``Tracker_URL_remover``, + ``Search_on_category_select`` ] + +``disabled_plugins``: optional + List of disabled plugins. + + :default: ``DOAI_rewrite``, ``Infinite_scroll``, ``Vim-like_hotkeys`` + :values: ``DOAI_rewrite``, ``HTTPS_rewrite``, ``Infinite_scroll``, + ``Vim-like_hotkeys``, ``Self_Informations``, ``Tracker_URL_remover``, + ``Search_on_category_select`` + +``enabled_engines`` : optional : *all* :origin:`engines ` + List of enabled engines. + +``disabled_engines`` : optional : *all* :origin:`engines ` + List of disabled engines. + diff --git a/docs/dev/svg_image.svg b/docs/dev/svg_image.svg new file mode 100644 index 000000000..5405f85b8 --- /dev/null +++ b/docs/dev/svg_image.svg @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/docs/dev/translation.rst b/docs/dev/translation.rst new file mode 100644 index 000000000..86c4c843b --- /dev/null +++ b/docs/dev/translation.rst @@ -0,0 +1,71 @@ +.. _translation: + +=========== +Translation +=========== + +.. _searx@transifex: https://www.transifex.com/asciimoo/searx/ + +Translation currently takes place on `searx@transifex`_ + +Requirements +============ + +* Transifex account +* Installed CLI tool of Transifex + +Init Transifex project +====================== + +After installing ``transifex`` using pip, run the following command to +initialize the project. + +.. code:: sh + + tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/ + + +After ``$HOME/.transifexrc`` is created, get a Transifex API key and insert it +into the configuration file. + +Create a configuration file for ``tx`` named ``$HOME/.tx/config``. + +.. code:: ini + + [main] + host = https://www.transifex.com + [searx.messagespo] + file_filter = searx/translations//LC_MESSAGES/messages.po + source_file = messages.pot + source_lang = en + type = PO + + +Then run ``tx set``: + +.. code:: shell + + tx set --auto-local -r searx.messagespo 'searx/translations//LC_MESSAGES/messages.po' \ + --source-lang en --type PO --source-file messages.pot --execute + + +Update translations +=================== + +To retrieve the latest translations, pull it from Transifex. + +.. code:: sh + + tx pull -a + +Then check the new languages. If strings translated are not enough, delete those +folders, because those should not be compiled. Call the command below to compile +the ``.po`` files. + +.. code:: shell + + pybabel compile -d searx/translations + + +After the compilation is finished commit the ``.po`` and ``.mo`` files and +create a PR. diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..d9503fef6 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,32 @@ +================ +Welcome to searx +================ + +Search without being tracked. + +.. sidebar:: Features + + - Self hosted + - No user tracking + - No user profiling + - About 70 supported search engines + - Easy integration with any search engine + - Cookies are not used by default + - Secure, encrypted connections (HTTPS/SSL) + - Hosted by organizations, such as *La Quadrature du Net*, which promote + digital rights + +Searx is a free internet metasearch engine which aggregates results from more +than 70 search services. Users are neither tracked nor profiled. Additionally, +searx can be used over Tor for online anonymity. + +Get started with searx by using one of the :wiki:`Searx-instances`. If you +don't trust anyone, you can set up your own, see :ref:`installation`. + +.. toctree:: + :maxdepth: 2 + + user/index + admin/index + dev/index + blog/index diff --git a/docs/static/img/searx_logo_small.png b/docs/static/img/searx_logo_small.png new file mode 100644 index 000000000..083932686 Binary files /dev/null and b/docs/static/img/searx_logo_small.png differ diff --git a/docs/user/index.rst b/docs/user/index.rst new file mode 100644 index 000000000..329be3b10 --- /dev/null +++ b/docs/user/index.rst @@ -0,0 +1,10 @@ +================== +User documentation +================== + +.. toctree:: + :maxdepth: 1 + + public_instances + search_syntax + own-instance diff --git a/docs/user/own-instance.rst b/docs/user/own-instance.rst new file mode 100644 index 000000000..a2f736562 --- /dev/null +++ b/docs/user/own-instance.rst @@ -0,0 +1,77 @@ +=========================== +Why use a private instance? +=========================== + +"Is it worth to run my own instance?" is a common question among searx users. +Before answering this question, see what options a searx user has. + +Public instances are open to everyone who has access to its URL. Usually, these +are operated by unknown parties (from the users' point of view). Private +instances can be used by a select group of people. It is for example a searx of +group of friends or a company which can be accessed through VPN. Also it can be +single user one which runs on the user's laptop. + +To gain more insight on how these instances work let's dive into how searx +protects its users. + +How does searx protect privacy? +=============================== + +Searx protects the privacy of its users in multiple ways regardless of the type +of the instance (private, public). Removal of private data from search requests +comes in three forms: + + 1. removal of private data from requests going to search services + 2. not forwarding anything from a third party services through search services + (e.g. advertisement) + 3. removal of private data from requests going to the result pages + +Removing private data means not sending cookies to external search engines and +generating a random browser profile for every request. Thus, it does not matter +if a public or private instance handles the request, because it is anonymized in +both cases. IP addresses will be the IP of the instance. But searx can be +configured to use proxy or Tor. `Result proxy +`__ is supported, too. + +Searx does not serve ads or tracking content unlike most search services. So +private data is not forwarded to third parties who might monetize it. Besides +protecting users from search services, both referring page and search query are +hidden from visited result pages. + + +What are the consequences of using public instances? +---------------------------------------------------- + +If someone uses a public instance, he/she has to trust the administrator of that +instance. This means that the user of the public instance does not know whether +his/her requests are logged, aggregated and sent or sold to a third party. + +Also, public instances without proper protection are more vulnerable to abusing +the search service, In this case the external service in exchange returns +CAPTCHAs or bans the IP of the instance. Thus, search requests return less +results. + +I see. What about private instances? +------------------------------------ + +If users run their own instances, everything is in their control: the source +code, logging settings and private data. Unknown instance administrators do not +have to be trusted. + +Furthermore, as the default settings of their instance is editable, there is no +need to use cookies to tailor searx to their needs. So preferences will not be +reset to defaults when clearing browser cookies. As settings are stored on +their computer, it will not be accessible to others as long as their computer is +not compromised. + +Conclusion +========== + +Always use an instance which is operated by people you trust. The privacy +features of searx are available to users no matter what kind of instance they +use. + +If someone is on the go or just wants to try searx for the first time public +instances are the best choices. Additionally, public instance are making a +world a better place, because those who cannot or do not want to run an +instance, have access to a privacy respecting search service. diff --git a/docs/user/public_instances.rst b/docs/user/public_instances.rst new file mode 100644 index 000000000..9665c58b7 --- /dev/null +++ b/docs/user/public_instances.rst @@ -0,0 +1,318 @@ +.. _public instances: + +.. + links has been ported from markdown to reST by:: + + regexpr: \[([^\]]*)\]\(([^)]*)\) + substitution: `\1 <\2>`__ + + +====================== +Public Searx instances +====================== + +.. _mailing list: mailto:searx-instances@autistici.org +.. _subscription page: https://www.autistici.org/mailman/listinfo/searx-instances + + +Useful information +================== + +* Up-to-date health report available on https://stats.searx.xyz [1]_, for onion + (tor) services: https://stats.searx.xyz/tor.html + +* Searx instances `mailing list`_ & `subscription page`_. + +* Some of the Searx instances have a CAcert SSL certificate. You can install the + missing root cert `from here `__. + +* To add your own Searx instance to this page send us your PR. A GitHub account + is required to send PR or add an issue. + +.. [1] Note that most of the instances with a A+ grade in CSP column in this + site are not fully functional - for example auto-completion may not work. + + +List of public Searx instances +============================== + +Meta-searx instances +==================== + +These are websites that source from other searx instances. These are useful if +you can't decide which Searx instance to use: + + +.. flat-table:: Meta-searx instances + :header-rows: 1 + :stub-columns: 0 + :widths: 2 1 2 4 4 + + * - clearnet host + - onion host + - issuer + - source selection method + - extra privacy features + + * - `Neocities `__ + - n/a + - Comodo (`Verification `__) + - Redirects users directly to a random selection of any known running + server after entering query. Requires + Javascript. `Changelog `__. + - Excludes servers with user tracking and analytics or are proxied through + Cloudflare. + + * - `Searxes `__ @Danwin + - onion v3 `hidden service + `__ + - Let's Encrypt (`Verification + `__) + - sources data from a randomly selected running server that satisfies + admin's quality standards which is used for post-processing + - filters out privacy-hostile websites (like CloudFlare) and either marks + them as such or folds them below the high ranking results. + + +Alive and running +================= + +**BEFORE EDITING**: Please add your Searx instance by respecting the alphabetic order. + +.. note:: + + Public instances listed here may yield less accurate results as they have + much higher traffic and consequently have a higher chance of being blocked by + search providers such as Google, Qwant, Bing, Startpage, etc. Hosting your + own instance or using an instance that isn't listed here may give you a more + consistent search experience. + +* `ai.deafpray.wtf/searx `__ - Issuer: Let's Encrypt `Verification `__ +* `bamboozle.it `__ - Issuer: Let's Encrypt `Verification `__ +* `bee.jaekr.dev `__ - Issuer: Let's Encrypt `Verification `__ +* `beezboo.com `__ - Issuer: Let's Encrypt `Verification `__ +* `burtrum.org/searx `__ - Issuer: Let's Encrypt `Verification `__ +* `darmarit.cloud/searx `__ - Issuer: Let's Encrypt `Verification `__ +* `dc.ax `__ - Issuer: Let's Encrypt `Verification `__ +* `dynabyte.ca `__ - Issuer: Let's Encrypt `Verification `__ +* `goso.ga `__ - Issuer: Let's Encrypt `Verification `__ +* `gruble.de `__ - Issuer: Let's Encrypt `Verification `__ +* `haku.ahmia.fi `__ - Issuer: Let's Encrypt `Verification `__ +* `haku.lelux.fi `__ - Issuer: Let's Encrypt `Verification `__ +* `huyo.me `__ - Issuer: Let's Encrypt `Verification `__ +* `jsearch.pw `__ - Issuer: Let's Encrypt `Verification `__ +* `le-dahut.com/searx `__ - Issuer: Let's Encrypt `Verification `__ +* `mijisou.com `__ - Issuer: Let's Encrypt `Verification `__ +* `null.media `__ - Issuer: Let's Encrypt `Verification `__ +* `openworlds.info `__ - Issuer: Let's Encrypt +* `perfectpixel.de/searx/ `__ - Issuer: LetsEncrypt `Verification `__ +* `ransack.i2p `__ - I2P eepsite, only accessible with `I2P `__ (`base32 address `__) +* `rapu.nz `__ - Issuer: Let's Encrypt `Verification `__ +* `roflcopter.fr `__ - Issuer: Let's Encrypt `Verification `__ +* `roteserver.de/searx `__ - Issuer: Let's Encrypt `Verification `__ +* `s.cmd.gg `__ - Issuer: Let's Encrypt `Verification `__ +* `search.activemail.de `__ - Issuer: Let's Encrypt `Verification `__ +* `search.anonymize.com `__ - Issuer: Let's Encrypt `Verification `__ +* `search.azkware.net `__ - Issuer: Let's Encrypt `Verification `__ +* `search.biboumail.fr `__ - Issuer: Let's Encrypt `Verification `__ +* `search.blankenberg.eu `__ - Issuer: Let's Encrypt `Verification `__ +* `search.d4networks.com `__ - Issuer: Let's Encrypt `Verification `__ +* `search.datensturm.net `__ - Issuer: Let's Encrypt `Verification `__ +* `search.disroot.org `__ - Issuer: Let's Encrypt `Verification `__ +* `search.ethibox.fr `__ - Issuer: Let's Encrypt `Verification `__ +* `search.fossdaily.xyz `__ - Issuer: Let's Encrypt `Verification `__ +* `search.galaxy.cat `__ - Issuer: Let's Encrypt `Verification `__ +* `search.gibberfish.org `__ (as `Hidden Service `__ or `Proxied through Tor `__) - Issuer: Let's Encrypt `Verification `__ +* `search.koehn.com `__ - Issuer: Let's Encrypt `Verification `__ +* `search.lgbtq.cool `__ - Issuer: Let's Encrypt `Verification `__ +* `search.mdosch.de `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `search.modalogi.com `__ - Issuer: Let's Encrypt `Verification `__ +* `search.moravit.com `__ - Issuer: Let's Encrypt `Verification `__ +* `search.nebulacentre.net `__ - Issuer: Let's Encrypt `Verification `__ +* `search.paulla.asso.fr `__ - Issuer: Let's Encrypt `Verification `__ +* `search.pifferi.info `__ - Issuer: Let's Encrypt `Verification `__ +* `search.poal.co `__ - Issuer: Let's Encrypt `Verification `__ +* `search.privacytools.io `__ - Issuer: Let's Encrypt `Verification `__ - Uses Matomo for user tracking and analytics +* `search.seds.nl `__ - Issuer: Let's Encrypt `Verification `__ +* `search.snopyta.org `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `search.spaeth.me `__ - Issuer: Let's Encrypt `Verification `__ +* `search.st8.at `__ - Issuer: Let's Encrypt `Verification `__ +* `search.stinpriza.org `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `search.sudo-i.net `__ - Issuer: Let's Encrypt `Verification `__ +* `search.tolstoevsky.ml `__ - Issuer: Let's Encrypt `Verification `__ +* `searchsin.com/searx `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.anongoth.pl `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.be `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.ca `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.canox.net `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.cybt.de `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.de `__ - Issuer: COMODO `Verification `__ +* `searx.decatec.de `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.devol.it `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.dnswarden.com `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.drakonix.net `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `searx.dresden.network `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.elukerio.org `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.everdot.org `__ - Issuer: Let's Encrypt `Verification `__ - Crawls using YaCy +* `searx.foo.li `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.fossencdi.org `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `searx.fr32k.de `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.good.one.pl `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `searx.gotrust.de `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `searx.hardwired.link `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.hlfh.space `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.info `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.itunix.eu `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.john-at-me.net `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.kvch.me `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.laquadrature.net `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `searx.lelux.fi `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.lhorn.de `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.li `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.libmail.eu `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.linux.pizza `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.lynnesbian.space `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.mastodontech.de `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.me `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `searx.mxchange.org `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.nakhan.net `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.nixnet.xyz `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `searx.nnto.net `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.openhoofd.nl `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.openpandora.org `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.operationtulip.com `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.orcadian.net `__ - Issuer: Comodo CA Limited `Verification `__ +* `searx.ouahpit.info `__ - Issuer: Let's Encrypt +* `searx.pofilo.fr `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.prvcy.eu `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `searx.pwoss.org `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.ro `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.ru `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.solusar.de `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.targaryen.house `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.tuxcloud.net `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.tyil.nl `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.wegeeks.win `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.win `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.xyz `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.zareldyn.net `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.zdechov.net `__ - Issuer: Let's Encrypt `Verification `__ +* `searxs.eu `__ - Issuer: Let's Encrypt `Verification `__ +* `seeks.hsbp.org `__ - Issuer: Let's Encrypt `Verification `__ - `PGP signed fingerprints of cert `__ +* `skyn3t.in/srx `__ - Issuer: Let's Encrypt | onion `hidden service `__ +* `spot.ecloud.global `__ - Issuer: Let's Encrypt `Verification `__ +* `srx.sx `__ - Issuer: Let's Encrypt `Verification `__ +* `stemy.me/searx `__ - Issuer: Let's Encrypt `Verification `__ +* `suche.dasnetzundich.de `__ - Issuer: Let's Encrypt `Verification `__ +* `suche.elaon.de `__ - Issuer: Let's Encrypt `Verification `__ +* `suche.xyzco456vwisukfg.onion `__ +* `suche.uferwerk.org `__ - Issuer: Let's Encrypt `Verification `__ +* `timdor.noip.me/searx `__ - Issuer: Let's Encrypt `Verification `__ +* `trovu.komun.org `__ - Issuer: Let's Encrypt `Verification `__ +* `unmonito.red `__ - Issuer: Let's Encrypt `Verification `__ +* `www.finden.tk `__ - Issuer: Let's Encrypt `Verification `__ +* `zoek.anchel.nl `__ - Issuer: Let's Encrypt `Verification `__ + + + +Running in exclusive private walled-gardens +=========================================== + +These instances run in walled-gardens that exclude some segment of the general +public (e.g. Tor users and users sharing IPs with many other users). Caution: +privacy is also compromised on these sites due to exposure of cleartext traffic +to a third party other than the website operator. + +* `intelme.com `__ - Issuer: Cloudflare `Verification `__ +* `search404.io `__ - Issuer: Cloudflare `Verification `__ +* `searx.com.au `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.lavatech.top `__ - Issuer: Cloudflare `Verification `__ +* `searchx.mobi `__ - Issuer: Cloudflare `Verification `__ +* `searx.org `__ - Issuer: Cloudflare `Verification `__ +* `searx.run `__ - Issuer: Cloudflare `Verification `__ +* `searx.world `__ - Issuer: Cloudflare `Verification `__ - Adds Amazon affiliate links + + +Running with an incorrect SSL certificate +========================================= + +* `listi.me `__ - Issuer: Let's Encrypt `Verification `__ +* `s.matejc.com `__ - Issuer: Let's Encrypt `Verification `__ +* `search.jollausers.de `__ - Incorrectly configured `SSL certificate `__ +* `search.paviro.de `__ - Issuer: LetsEncrypt `Verification `__ +* `searx.abenthung.it `__ - Issuer: Comodo CA Limited `Verification `__ +* `searx.coding4schoki.org `__ - Incorrectly configured `SSL Certificate `__ +* `searx.haxors.club `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.nulltime.net `__ (as `Hidden Service `__) - Issuer: Let's Encrypt `Verification `__ +* `searx.ch `__ - Issuer: Let's Encrypt `Verification `__ (cert clock problems) + + +Offline +======= + +* `a.searx.space `__ - Issuer: Let's Encrypt `Verification `__ (unstable, under construction). +* `anyonething.de `__ - (was found to have become a pastebin on or before 2019-03-01) Issuer: Comodo CA Limited (Warning: uses Cloudflare) `Verification `__ +* `h7jwxg5rakyfvikpi.onion `__ - available only as Tor Hidden Service (down on 2019-06-26) +* `hacktivis.me/searx `__ - (down) - Issuer: Let's Encrypt `Verification `__ +* `icebal.com `__ - (down) Issuer: Let's Encrypt +* `netrangler.host `__ - (down) - Issuer: Let's Encrypt `Verification `__ +* `opengo.nl `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `p9e.de `__ - (down - timeout) Issuer: Let's Encrypt `Verification `__ +* `rubri.co `__ - (down) Issuer: Let's Encrypt +* `s.bacafe.xyz `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `search.alecpap.com `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `search.blackit.de `__ - (down) Let's Encrypt `Verification `__ +* `search.deblan.org `__ (down) - Issuer: COMODO via GANDI `Verification `__ +* `search.homecomputing.fr `__ - (down) Issuer: CAcert `Verification `__ +* `search.jpope.org `__ - (down - timeout) Issuer: Let's Encrypt `Verification `__ +* `search.kakise.xyz `__ - down +* `search.kosebamse.com `__ - Issuer: LetsEncrypt `Verification `__ +* `search.kujiu.org `__ - (down) Issuer: Let's Encrypt +* `search.mailaender.coffee `__ - Issuer: Let's Encrypt `Verification `__ +* `search.matrix.ac `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `search.mypsc.ca `__ - Issuer: Let's Encrypt `Verification `__ +* `search.namedkitten.pw `__ - (SSL error) - Issuer: Let's Encrypt `Verification `__ +* `search.opentunisia.org `__ - Issuer: Let's Encrypt `Verification `__ +* `search.r3d007.com `__ - (down) Issuer: Let's Encrypt +* `search.static.lu `__ - (down) Issuer: StartCom `Verification `__ +* `search.teej.xyz `__ - (down) Issuer: LetsEncrypt `Verification `__ +* `search.wxzm.sx `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.4ray.co `__ - (no longer an instance, redirects to main page) Issuer: Let's Encrypt `Verification `__ +* `searx.32bitflo.at `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `searx.ahh.si `__ - (down) - Issuer: Let's Encrypt `Verification `__ +* `searx.angristan.xyz `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `searx.antirep.net `__ - (return a 502 HTTP error) Issuer: Let's Encrypt `Verification `__ +* `searx.aquilenet.fr `__ - (down - 429 HTTP error) Issuer: Let's Encrypt `Verification `__ +* `searx.at `__ - (return "request exception" at every search) Issuer: Let's Encrypt `Verification `__ +* `searx.cc `__ - (down on 2019-06-26) Issuer: Let's Encrypt `Verification `__ +* `searx.dk `__ - (down - 429 HTTP error) Issuer: Let's Encrypt `Verification `__ +* `searx.ehrmanns.ch `__ - (down) Issuer: Let's Encrypt +* `searx.glibre.net `__ - Issuer: Let's Encrypt `Verification `__ +* `searx.infini.fr `__ - (return a page stating that the website is not installed) Issuer: Let's Encrypt `Verification `__ +* `searx.jeanphilippemorvan.info `__ - (down) Issuer: StartCom `Verification `__ +* `searx.lhorn.de `__ - (redirect the Searx's github repository page) Issuer: Let's Encrypt `Verification `__ (only reachable from european countries) +* `searx.lvweb.host `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `searx.mrtino.eu `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `searx.netzspielplatz.de `__ - (error page about GDPR even when browsing it from USA and Asia) - Issuer: Let's Encrypt `Verification `__ +* `searx.new-admin.net `__ - (down) Issuer: Let's Encrypt +* `searx.nogafa.org `__ - (broken CSS) Issuer: Let's Encrypt `Verification `__ +* `searx.potato.hu `__ - (not a searx instance) - Issuer: Let's Encrypt `Verification `__ +* `searx.rubbeldiekatz.info `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `searx.s42.space `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `searx.salcay.hu `__ - (down - blank page) Issuer: Let's Encrypt `Verification `__ +* `searx.selea.se `__ - (Leads to default Apache page) Issuer: RapidSSL (HSTS preloaded, DNSSEC) `Verification `__ | `HSTS Preload `__ +* `searx.steinscraft.net `__ - (down) Issuer: Cloudflare +* `searx.techregion.de `__ - (domain expired) - Issuer: Let's Encrypt `Verification `__ +* `searx.tognella.com `__ - (down) Issuer: Cloudflare +* `searx.xi.ht `__ - (return a 502 HTTP error) Issuer: Let's Encrypt `Verification `__ +* `searxist.com `__ - (down) - Issuer: Let's Encrypt `Verification `__ +* `so.sb `__ - (down) - Issuer: Let's Encrypt `Verification `__ +* `srx.stdout.net `__ - Issuer: Let's Encrypt `Verification `__ +* `w6f7cgdm54cyvohcuhraaafhajctyj3ihenrovuxogoagrr5g43qmoid.onion `__ - Hidden Service +* `win8linux.nohost.me `__ - (down) Issuer: Let's Encrypt +* `wiznet.tech `__ - (down) - Issuer: Let's Encrypt `Verification `__ +* `www.mercurius.space `__ - (down) Issuer: Let's Encrypt +* `www.ready.pm `__ - Issuer: WoSign `Verification `__ +* `z.awsmppl.com `__ - (down) Issuer: Let's Encrypt `Verification `__ +* `zlsdzh.tk `__ - (down - 404 HTTP error) Issuer: TrustAsia Technologies, Inc. `Verification `__ * + diff --git a/docs/user/search_syntax.rst b/docs/user/search_syntax.rst new file mode 100644 index 000000000..b738c7274 --- /dev/null +++ b/docs/user/search_syntax.rst @@ -0,0 +1,42 @@ + +.. _search-syntax: + +============= +Search syntax +============= + +Searx allows you to modify the default categories, engines and search language +via the search query. + +Prefix ``!`` + to set Category/engine + +Prefix: ``:`` + to set language + +Prefix: ``?`` + to add engines and categories to the currently selected categories + +Abbrevations of the engines and languages are also accepted. Engine/category +modifiers are chainable and inclusive (e.g. with :search:`!it !ddg !wp qwer +` search in IT category **and** duckduckgo +**and** wikipedia for ``qwer``). + +See the :search:`/preferences page ` for the list of engines, +categories and languages. + +Examples +======== + +Search in wikipedia for ``qwer``: + +- :search:`!wp qwer ` or +- :search:`!wikipedia qwer :search:` + +Image search: + +- :search:`!images Cthulhu ` + +Custom language in wikipedia: + +- :search:`:hu !wp hackerspace ` diff --git a/manage.sh b/manage.sh index dbe48d31d..496a522ba 100755 --- a/manage.sh +++ b/manage.sh @@ -18,12 +18,12 @@ ACTION="$1" update_packages() { pip install --upgrade pip pip install --upgrade setuptools - pip install -r "$BASE_DIR/requirements.txt" + pip install -Ur "$BASE_DIR/requirements.txt" } update_dev_packages() { update_packages - pip install -r "$BASE_DIR/requirements-dev.txt" + pip install -Ur "$BASE_DIR/requirements-dev.txt" } install_geckodriver() { @@ -70,6 +70,11 @@ locales() { pybabel compile -d "$SEARX_DIR/translations" } +update_useragents() { + echo '[!] Updating user agent versions' + python utils/fetch_firefox_version.py +} + pep8_check() { echo '[!] Running pep8 check' # ignored rules: @@ -246,6 +251,7 @@ Commands update_dev_packages - Check & update development and production dependency changes install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests) npm_packages - Download & install npm dependencies + update_useragents - Update useragents.json with the most recent versions of Firefox Build ----- diff --git a/requirements-dev.txt b/requirements-dev.txt index 5e015a88a..3e8f617af 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,6 @@ +pallets-sphinx-themes +Sphinx +sphinx-issues mock==2.0.0 nose2[coverage_plugin] cov-core==1.15.0 @@ -8,3 +11,6 @@ transifex-client==0.12.2 unittest2==1.1.0 zope.testrunner==4.5.1 selenium==3.141.0 +linuxdoc @ git+http://github.com/return42/linuxdoc.git +sphinx-jinja +sphinx-tabs diff --git a/searx/data/useragents.json b/searx/data/useragents.json index 850bc418a..abb81000c 100644 --- a/searx/data/useragents.json +++ b/searx/data/useragents.json @@ -1,14 +1,15 @@ { - "ua": "Mozilla/5.0 ({os}; rv:{version}) Gecko/20100101 Firefox/{version}", "versions": [ - "61.0.1", - "61.0", - "60.0.2", - "60.0.1", - "60.0" + "70.0.1", + "70.0", + "69.0.3", + "69.0.2", + "69.0.1", + "69.0" ], "os": [ "Windows NT 10; WOW64", "X11; Linux x86_64" - ] + ], + "ua": "Mozilla/5.0 ({os}; rv:{version}) Gecko/20100101 Firefox/{version}" } \ No newline at end of file diff --git a/searx/engines/bing.py b/searx/engines/bing.py index ed0b87dbd..b193f7c60 100644 --- a/searx/engines/bing.py +++ b/searx/engines/bing.py @@ -89,8 +89,7 @@ def response(resp): 'content': content}) try: - result_len_container = "".join(eval_xpath(dom, '//span[@class="sb_count"]/text()')) - result_len_container = utils.to_string(result_len_container) + result_len_container = "".join(eval_xpath(dom, '//span[@class="sb_count"]//text()')) if "-" in result_len_container: # Remove the part "from-to" for paginated request ... result_len_container = result_len_container[result_len_container.find("-") * 2 + 2:] @@ -102,7 +101,7 @@ def response(resp): logger.debug('result error :\n%s', e) pass - if _get_offset_from_pageno(resp.search_params.get("pageno", 0)) > result_len: + if result_len and _get_offset_from_pageno(resp.search_params.get("pageno", 0)) > result_len: return [] results.append({'number_of_results': result_len}) diff --git a/searx/engines/flickr_noapi.py b/searx/engines/flickr_noapi.py index 198ac2cff..c8ee34f7a 100644 --- a/searx/engines/flickr_noapi.py +++ b/searx/engines/flickr_noapi.py @@ -109,14 +109,22 @@ def response(resp): else: url = build_flickr_url(photo['ownerNsid'], photo['id']) - results.append({'url': url, - 'title': title, - 'img_src': img_src, - 'thumbnail_src': thumbnail_src, - 'content': content, - 'author': author, - 'source': source, - 'img_format': img_format, - 'template': 'images.html'}) + result = { + 'url': url, + 'img_src': img_src, + 'thumbnail_src': thumbnail_src, + 'source': source, + 'img_format': img_format, + 'template': 'images.html' + } + try: + result['author'] = author + result['title'] = title + result['content'] = content + except: + result['author'] = '' + result['title'] = '' + result['content'] = '' + results.append(result) return results diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py index a84f3f69d..2bb29a9fe 100644 --- a/searx/engines/gigablast.py +++ b/searx/engines/gigablast.py @@ -14,6 +14,7 @@ import random from json import loads from time import time from lxml.html import fromstring +from searx.poolrequests import get from searx.url_utils import urlencode from searx.utils import eval_xpath @@ -31,13 +32,9 @@ search_string = 'search?{query}'\ '&c=main'\ '&s={offset}'\ '&format=json'\ - '&qh=0'\ - '&qlang={lang}'\ + '&langcountry={lang}'\ '&ff={safesearch}'\ - '&rxiec={rxieu}'\ - '&ulse={ulse}'\ - '&rand={rxikd}'\ - '&dbez={dbez}' + '&rand={rxikd}' # specific xpath variables results_xpath = '//response//result' url_xpath = './/url' @@ -46,9 +43,26 @@ content_xpath = './/sum' supported_languages_url = 'https://gigablast.com/search?&rxikd=1' +extra_param = '' # gigablast requires a random extra parameter +# which can be extracted from the source code of the search page + + +def parse_extra_param(text): + global extra_param + param_lines = [x for x in text.splitlines() if x.startswith('var url=') or x.startswith('url=url+')] + extra_param = '' + for l in param_lines: + extra_param += l.split("'")[1] + extra_param = extra_param.split('&')[-1] + + +def init(engine_settings=None): + parse_extra_param(get('http://gigablast.com/search?c=main&qlangcountry=en-us&q=south&s=10').text) + # do search-request def request(query, params): + print("EXTRAPARAM:", extra_param) offset = (params['pageno'] - 1) * number_of_results if params['language'] == 'all': @@ -67,14 +81,11 @@ def request(query, params): search_path = search_string.format(query=urlencode({'q': query}), offset=offset, number_of_results=number_of_results, - rxikd=int(time() * 1000), - rxieu=random.randint(1000000000, 9999999999), - ulse=random.randint(100000000, 999999999), lang=language, - safesearch=safesearch, - dbez=random.randint(100000000, 999999999)) + rxikd=int(time() * 1000), + safesearch=safesearch) - params['url'] = base_url + search_path + params['url'] = base_url + search_path + '&' + extra_param return params @@ -84,7 +95,11 @@ def response(resp): results = [] # parse results - response_json = loads(resp.text) + try: + response_json = loads(resp.text) + except: + parse_extra_param(resp.text) + raise Exception('extra param expired, please reload') for result in response_json['results']: # append result diff --git a/searx/engines/ina.py b/searx/engines/ina.py index 37a05f099..ea509649f 100644 --- a/searx/engines/ina.py +++ b/searx/engines/ina.py @@ -32,7 +32,7 @@ base_url = 'https://www.ina.fr' search_url = base_url + '/layout/set/ajax/recherche/result?autopromote=&hf={ps}&b={start}&type=Video&r=&{query}' # specific xpath variables -results_xpath = '//div[contains(@class,"search-results--list")]/div[@class="media"]' +results_xpath = '//div[contains(@class,"search-results--list")]//div[@class="media-body"]' url_xpath = './/a/@href' title_xpath = './/h3[@class="h3--title media-heading"]' thumbnail_xpath = './/img/@src' @@ -65,8 +65,11 @@ def response(resp): videoid = result.xpath(url_xpath)[0] url = base_url + videoid title = p.unescape(extract_text(result.xpath(title_xpath))) - thumbnail = extract_text(result.xpath(thumbnail_xpath)[0]) - if thumbnail[0] == '/': + try: + thumbnail = extract_text(result.xpath(thumbnail_xpath)[0]) + except: + thumbnail = '' + if thumbnail and thumbnail[0] == '/': thumbnail = base_url + thumbnail d = extract_text(result.xpath(publishedDate_xpath)[0]) d = d.split('/') diff --git a/searx/engines/microsoft_academic.py b/searx/engines/microsoft_academic.py index 9387b08d0..9bac0069c 100644 --- a/searx/engines/microsoft_academic.py +++ b/searx/engines/microsoft_academic.py @@ -45,6 +45,8 @@ def request(query, params): def response(resp): results = [] response_data = loads(resp.text) + if not response_data: + return results for result in response_data['results']: url = _get_url(result) diff --git a/searx/engines/openstreetmap.py b/searx/engines/openstreetmap.py index 733ba6203..cec10a3c7 100644 --- a/searx/engines/openstreetmap.py +++ b/searx/engines/openstreetmap.py @@ -24,7 +24,7 @@ result_base_url = 'https://openstreetmap.org/{osm_type}/{osm_id}' # do search-request def request(query, params): - params['url'] = base_url + search_string.format(query=query) + params['url'] = base_url + search_string.format(query=query.decode('utf-8')) return params diff --git a/searx/engines/qwant.py b/searx/engines/qwant.py index de12955c6..54e9dafad 100644 --- a/searx/engines/qwant.py +++ b/searx/engines/qwant.py @@ -50,6 +50,7 @@ def request(query, params): language = match_language(params['language'], supported_languages, language_aliases) params['url'] += '&locale=' + language.replace('-', '_').lower() + params['headers']['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0' return params diff --git a/searx/engines/scanr_structures.py b/searx/engines/scanr_structures.py index 72fd2b3c9..7208dcb70 100644 --- a/searx/engines/scanr_structures.py +++ b/searx/engines/scanr_structures.py @@ -29,7 +29,7 @@ def request(query, params): params['url'] = search_url params['method'] = 'POST' params['headers']['Content-type'] = "application/json" - params['data'] = dumps({"query": query, + params['data'] = dumps({"query": query.decode('utf-8'), "searchField": "ALL", "sortDirection": "ASC", "sortOrder": "RELEVANCY", diff --git a/searx/engines/spotify.py b/searx/engines/spotify.py index aed756be3..00c395706 100644 --- a/searx/engines/spotify.py +++ b/searx/engines/spotify.py @@ -12,10 +12,14 @@ from json import loads from searx.url_utils import urlencode +import requests +import base64 # engine dependent config categories = ['music'] paging = True +api_client_id = None +api_client_secret = None # search-url url = 'https://api.spotify.com/' @@ -31,6 +35,16 @@ def request(query, params): params['url'] = search_url.format(query=urlencode({'q': query}), offset=offset) + r = requests.post( + 'https://accounts.spotify.com/api/token', + data={'grant_type': 'client_credentials'}, + headers={'Authorization': 'Basic ' + base64.b64encode( + "{}:{}".format(api_client_id, api_client_secret).encode('utf-8') + ).decode('utf-8')} + ) + j = loads(r.text) + params['headers'] = {'Authorization': 'Bearer {}'.format(j.get('access_token'))} + return params diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py index 4dae735d1..a216ba886 100644 --- a/searx/engines/wikipedia.py +++ b/searx/engines/wikipedia.py @@ -21,7 +21,8 @@ search_url = base_url + u'w/api.php?'\ 'action=query'\ '&format=json'\ '&{query}'\ - '&prop=extracts|pageimages'\ + '&prop=extracts|pageimages|pageprops'\ + '&ppprop=disambiguation'\ '&exintro'\ '&explaintext'\ '&pithumbsize=300'\ @@ -79,12 +80,15 @@ def response(resp): # wikipedia article's unique id # first valid id is assumed to be the requested article + if 'pages' not in search_result['query']: + return results + for article_id in search_result['query']['pages']: page = search_result['query']['pages'][article_id] if int(article_id) > 0: break - if int(article_id) < 0: + if int(article_id) < 0 or 'disambiguation' in page.get('pageprops', {}): return [] title = page.get('title') @@ -96,6 +100,7 @@ def response(resp): extract = page.get('extract') summary = extract_first_paragraph(extract, title, image) + summary = summary.replace('() ', '') # link to wikipedia article wikipedia_link = base_url.format(language=url_lang(resp.search_params['language'])) \ diff --git a/searx/settings.yml b/searx/settings.yml index c6f805331..2777f9caa 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -79,9 +79,10 @@ engines: categories : science timeout : 4.0 - - name : base - engine : base - shortcut : bs +# tmp suspended: dh key too small +# - name : base +# engine : base +# shortcut : bs - name : wikipedia engine : wikipedia @@ -408,7 +409,7 @@ engines: - name : library genesis engine : xpath - search_url : http://libgen.io/search.php?req={query} + search_url : https://libgen.is/search.php?req={query} url_xpath : //a[contains(@href,"bookfi.net")]/@href title_xpath : //a[contains(@href,"book/")]/text()[1] content_xpath : //td/a[1][contains(@href,"=author")]/text() @@ -464,7 +465,7 @@ engines: - name : openairedatasets engine : json_engine paging : True - search_url : http://api.openaire.eu/search/datasets?format=json&page={pageno}&size=10&title={query} + search_url : https://api.openaire.eu/search/datasets?format=json&page={pageno}&size=10&title={query} results_query : response/results/result url_query : metadata/oaf:entity/oaf:result/children/instance/webresource/url/$ title_query : metadata/oaf:entity/oaf:result/title/$ @@ -476,7 +477,7 @@ engines: - name : openairepublications engine : json_engine paging : True - search_url : http://api.openaire.eu/search/publications?format=json&page={pageno}&size=10&title={query} + search_url : https://api.openaire.eu/search/publications?format=json&page={pageno}&size=10&title={query} results_query : response/results/result url_query : metadata/oaf:entity/oaf:result/children/instance/webresource/url/$ title_query : metadata/oaf:entity/oaf:result/title/$ @@ -552,10 +553,11 @@ engines: timeout : 10.0 disabled : True - - name : scanr structures - shortcut: scs - engine : scanr_structures - disabled : True +# tmp suspended: bad certificate +# - name : scanr structures +# shortcut: scs +# engine : scanr_structures +# disabled : True - name : soundcloud engine : soundcloud @@ -598,9 +600,12 @@ engines: shortcut : se categories : science - - name : spotify - engine : spotify - shortcut : stf +# Spotify needs API credentials +# - name : spotify +# engine : spotify +# shortcut : stf +# api_client_id : ******* +# api_client_secret : ******* - name : startpage engine : startpage @@ -812,7 +817,7 @@ locales: doi_resolvers : oadoi.org : 'https://oadoi.org/' doi.org : 'https://doi.org/' - doai.io : 'http://doai.io/' - sci-hub.tw : 'http://sci-hub.tw/' + doai.io : 'https://doai.io/' + sci-hub.tw : 'https://sci-hub.tw/' default_doi_resolver : 'oadoi.org' diff --git a/searx/settings_robot.yml b/searx/settings_robot.yml index 635809041..25f229e56 100644 --- a/searx/settings_robot.yml +++ b/searx/settings_robot.yml @@ -43,7 +43,7 @@ locales: doi_resolvers : oadoi.org : 'https://oadoi.org/' doi.org : 'https://doi.org/' - doai.io : 'http://doai.io/' - sci-hub.tw : 'http://sci-hub.tw/' + doai.io : 'https://doai.io/' + sci-hub.tw : 'https://sci-hub.tw/' default_doi_resolver : 'oadoi.org' diff --git a/searx/static/plugins/js/vim_hotkeys.js b/searx/static/plugins/js/vim_hotkeys.js index 13bd070e0..b0f265cb5 100644 --- a/searx/static/plugins/js/vim_hotkeys.js +++ b/searx/static/plugins/js/vim_hotkeys.js @@ -125,6 +125,14 @@ $(document).ready(function() { } }); + function nextResult(current, direction) { + var next = current[direction](); + while (!next.is('.result') && next.length !== 0) { + next = next[direction](); + } + return next + } + function highlightResult(which) { return function() { var current = $('.result[data-vim-selected]'); @@ -157,13 +165,13 @@ $(document).ready(function() { } break; case 'down': - next = current.next('.result'); + next = nextResult(current, 'next'); if (next.length === 0) { next = $('.result:first'); } break; case 'up': - next = current.prev('.result'); + next = nextResult(current, 'prev'); if (next.length === 0) { next = $('.result:last'); } diff --git a/searx/static/themes/legacy/less/autocompleter.less b/searx/static/themes/legacy/less/autocompleter.less index db9601aeb..4ab2508f8 100644 --- a/searx/static/themes/legacy/less/autocompleter.less +++ b/searx/static/themes/legacy/less/autocompleter.less @@ -1,61 +1,61 @@ -/* - * searx, A privacy-respecting, hackable metasearch engine - */ - -ul { - &.autocompleter-choices { - position: absolute; - margin: 0; - padding: 0; - list-style: none; - border: 1px solid @color-autocompleter-choices-border; - border-left-color: @color-autocompleter-choices-border-left-right; - border-right-color: @color-autocompleter-choices-border-left-right; - border-bottom-color: @color-autocompleter-choices-border-bottom; - text-align: left; - font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; - z-index: 50; - background-color: @color-autocompleter-choices-background; - color: @color-autocompleter-choices-font; - - li { - position: relative; - margin: -2px 0 0 0; - padding: 0.2em 1.5em 0.2em 1em; - display: block; - float: none !important; - cursor: pointer; - font-weight: normal; - white-space: nowrap; - font-size: 1em; - line-height: 1.5em; - - &.autocompleter-selected { - background-color: @color-autocompleter-selected-background; - color: @color-autocompleter-selected-font; - - span.autocompleter-queried { - color: @color-autocompleter-selected-queried-font; - } - } - } - - span.autocompleter-queried { - display: inline; - float: none; - font-weight: bold; - margin: 0; - padding: 0; - } - } -} - -/*.autocompleter-loading { - //background-image: url(images/spinner.gif); - background-repeat: no-repeat; - background-position: right 50%; -}*/ - -/*textarea.autocompleter-loading { - background-position: right bottom; -}*/ +/* + * searx, A privacy-respecting, hackable metasearch engine + */ + +ul { + &.autocompleter-choices { + position: absolute; + margin: 0; + padding: 0; + list-style: none; + border: 1px solid @color-autocompleter-choices-border; + border-left-color: @color-autocompleter-choices-border-left-right; + border-right-color: @color-autocompleter-choices-border-left-right; + border-bottom-color: @color-autocompleter-choices-border-bottom; + text-align: left; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + z-index: 50; + background-color: @color-autocompleter-choices-background; + color: @color-autocompleter-choices-font; + + li { + position: relative; + margin: -2px 0 0 0; + padding: 0.2em 1.5em 0.2em 1em; + display: block; + float: none !important; + cursor: pointer; + font-weight: normal; + white-space: nowrap; + font-size: 1em; + line-height: 1.5em; + + &.autocompleter-selected { + background-color: @color-autocompleter-selected-background; + color: @color-autocompleter-selected-font; + + span.autocompleter-queried { + color: @color-autocompleter-selected-queried-font; + } + } + } + + span.autocompleter-queried { + display: inline; + float: none; + font-weight: bold; + margin: 0; + padding: 0; + } + } +} + +/*.autocompleter-loading { + //background-image: url(images/spinner.gif); + background-repeat: no-repeat; + background-position: right 50%; +}*/ + +/*textarea.autocompleter-loading { + background-position: right bottom; +}*/ diff --git a/searx/static/themes/oscar/gruntfile.js b/searx/static/themes/oscar/gruntfile.js index 591399449..def035dba 100644 --- a/searx/static/themes/oscar/gruntfile.js +++ b/searx/static/themes/oscar/gruntfile.js @@ -24,7 +24,7 @@ module.exports = function(grunt) { jshint: { files: ['gruntfile.js', 'js/searx_src/*.js'], options: { - reporterOutput: "", + reporterOutput: "", // options here to override JSHint defaults globals: { jQuery: true, @@ -55,7 +55,7 @@ module.exports = function(grunt) { "css/logicodev-dark.min.css": "less/logicodev-dark/oscar.less"} }, /* - // built with ./manage.sh styles + // built with ./manage.sh styles bootstrap: { options: { paths: ["less/bootstrap"], @@ -90,7 +90,7 @@ module.exports = function(grunt) { grunt.registerTask('test', ['jshint']); grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'less']); - + grunt.registerTask('styles', ['less']); }; diff --git a/searx/static/themes/oscar/js/searx.js b/searx/static/themes/oscar/js/searx.js index 58b38f019..927aeb422 100644 --- a/searx/static/themes/oscar/js/searx.js +++ b/searx/static/themes/oscar/js/searx.js @@ -1,26 +1,26 @@ -/** - * searx is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * searx is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with searx. If not, see < http://www.gnu.org/licenses/ >. - * - * (C) 2014 by Thomas Pointhuber, - */ - -requirejs.config({ - baseUrl: './static/themes/oscar/js', - paths: { - app: '../app' - } -}); +/** + * searx is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * searx is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with searx. If not, see < http://www.gnu.org/licenses/ >. + * + * (C) 2014 by Thomas Pointhuber, + */ + +requirejs.config({ + baseUrl: './static/themes/oscar/js', + paths: { + app: '../app' + } +}); ;/** * searx is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -51,306 +51,306 @@ window.searx = (function(d) { method: script.getAttribute('data-method') }; })(document); -;/** - * searx is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * searx is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with searx. If not, see < http://www.gnu.org/licenses/ >. - * - * (C) 2014 by Thomas Pointhuber, - */ - -if(searx.autocompleter) { - searx.searchResults = new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), - queryTokenizer: Bloodhound.tokenizers.whitespace, - remote: './autocompleter?q=%QUERY' - }); - searx.searchResults.initialize(); -} - -$(document).ready(function(){ - if(searx.autocompleter) { - $('#q').typeahead(null, { - name: 'search-results', - displayKey: function(result) { - return result; - }, - source: searx.searchResults.ttAdapter() - }); - } -}); -;/** - * searx is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * searx is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with searx. If not, see < http://www.gnu.org/licenses/ >. - * - * (C) 2014 by Thomas Pointhuber, - */ - -$(document).ready(function(){ - /** - * focus element if class="autofocus" and id="q" - */ - $('#q.autofocus').focus(); - - /** - * select full content on click if class="select-all-on-click" - */ - $(".select-all-on-click").click(function () { - $(this).select(); - }); - - /** - * change text during btn-collapse click if possible - */ - $('.btn-collapse').click(function() { - var btnTextCollapsed = $(this).data('btn-text-collapsed'); - var btnTextNotCollapsed = $(this).data('btn-text-not-collapsed'); - - if(btnTextCollapsed !== '' && btnTextNotCollapsed !== '') { - if($(this).hasClass('collapsed')) { - new_html = $(this).html().replace(btnTextCollapsed, btnTextNotCollapsed); - } else { - new_html = $(this).html().replace(btnTextNotCollapsed, btnTextCollapsed); - } - $(this).html(new_html); - } - }); - - /** - * change text during btn-toggle click if possible - */ - $('.btn-toggle .btn').click(function() { - var btnClass = 'btn-' + $(this).data('btn-class'); - var btnLabelDefault = $(this).data('btn-label-default'); - var btnLabelToggled = $(this).data('btn-label-toggled'); - if(btnLabelToggled !== '') { - if($(this).hasClass('btn-default')) { - new_html = $(this).html().replace(btnLabelDefault, btnLabelToggled); - } else { - new_html = $(this).html().replace(btnLabelToggled, btnLabelDefault); - } - $(this).html(new_html); - } - $(this).toggleClass(btnClass); - $(this).toggleClass('btn-default'); - }); - - /** - * change text during btn-toggle click if possible - */ - $('.media-loader').click(function() { - var target = $(this).data('target'); - var iframe_load = $(target + ' > iframe'); - var srctest = iframe_load.attr('src'); - if(srctest === undefined || srctest === false){ - iframe_load.attr('src', iframe_load.data('src')); - } - }); - - /** - * Select or deselect every categories on double clic - */ - $(".btn-sm").dblclick(function() { - var btnClass = 'btn-' + $(this).data('btn-class'); // primary - if($(this).hasClass('btn-default')) { - $(".btn-sm > input").attr('checked', 'checked'); - $(".btn-sm > input").prop("checked", true); - $(".btn-sm").addClass(btnClass); - $(".btn-sm").addClass('active'); - $(".btn-sm").removeClass('btn-default'); - } else { - $(".btn-sm > input").attr('checked', ''); - $(".btn-sm > input").removeAttr('checked'); - $(".btn-sm > input").checked = false; - $(".btn-sm").removeClass(btnClass); - $(".btn-sm").removeClass('active'); - $(".btn-sm").addClass('btn-default'); - } - }); -}); -;/** - * searx is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * searx is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with searx. If not, see < http://www.gnu.org/licenses/ >. - * - * (C) 2014 by Thomas Pointhuber, - */ - -$(document).ready(function(){ - $(".searx_overpass_request").on( "click", function( event ) { - var overpass_url = "https://overpass-api.de/api/interpreter?data="; - var query_start = overpass_url + "[out:json][timeout:25];("; - var query_end = ");out meta;"; - - var osm_id = $(this).data('osm-id'); - var osm_type = $(this).data('osm-type'); - var result_table = $(this).data('result-table'); - var result_table_loadicon = "#" + $(this).data('result-table-loadicon'); - - // tags which can be ignored - var osm_ignore_tags = [ "addr:city", "addr:country", "addr:housenumber", "addr:postcode", "addr:street" ]; - - if(osm_id && osm_type && result_table) { - result_table = "#" + result_table; - var query = null; - switch(osm_type) { - case 'node': - query = query_start + "node(" + osm_id + ");" + query_end; - break; - case 'way': - query = query_start + "way(" + osm_id + ");" + query_end; - break; - case 'relation': - query = query_start + "relation(" + osm_id + ");" + query_end; - break; - default: - break; - } - if(query) { - //alert(query); - var ajaxRequest = $.ajax( query ) - .done(function( html) { - if(html && html.elements && html.elements[0]) { - var element = html.elements[0]; - var newHtml = $(result_table).html(); - for (var row in element.tags) { - if(element.tags.name === null || osm_ignore_tags.indexOf(row) == -1) { - newHtml += "
" + row + ""; - switch(row) { - case "phone": - case "fax": - newHtml += "" + element.tags[row] + ""; - break; - case "email": - newHtml += "" + element.tags[row] + ""; - break; - case "website": - case "url": - newHtml += "" + element.tags[row] + ""; - break; - case "wikidata": - newHtml += "" + element.tags[row] + ""; - break; - case "wikipedia": - if(element.tags[row].indexOf(":") != -1) { - newHtml += "" + element.tags[row] + ""; - break; - } - /* jshint ignore:start */ - default: - /* jshint ignore:end */ - newHtml += element.tags[row]; - break; - } - newHtml += "
"; - } - } - $(result_table).html(newHtml); - $(result_table).removeClass('hidden'); - $(result_table_loadicon).addClass('hidden'); - } - }) - .fail(function() { - $(result_table_loadicon).html($(result_table_loadicon).html() + "

could not load data!

"); - }); - } - } - - // this event occour only once per element - $( this ).off( event ); - }); - - $(".searx_init_map").on( "click", function( event ) { - var leaflet_target = $(this).data('leaflet-target'); - var map_lon = $(this).data('map-lon'); - var map_lat = $(this).data('map-lat'); - var map_zoom = $(this).data('map-zoom'); - var map_boundingbox = $(this).data('map-boundingbox'); - var map_geojson = $(this).data('map-geojson'); - - require(['leaflet-0.7.3.min'], function(leaflet) { - if(map_boundingbox) { - southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]); - northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]); - map_bounds = L.latLngBounds(southWest, northEast); - } - - // TODO hack - // change default imagePath - L.Icon.Default.imagePath = "./static/themes/oscar/img/map"; - - // init map - var map = L.map(leaflet_target); - - // create the tile layer with correct attribution - var osmMapnikUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; - var osmMapnikAttrib='Map data © OpenStreetMap contributors'; - var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib}); - - var osmWikimediaUrl='https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png'; - var osmWikimediaAttrib = 'Wikimedia maps beta | Maps data © OpenStreetMap contributors'; - var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib}); - - // init map view - if(map_bounds) { - // TODO hack: https://github.com/Leaflet/Leaflet/issues/2021 - setTimeout(function () { - map.fitBounds(map_bounds, { - maxZoom:17 - }); - }, 0); - } else if (map_lon && map_lat) { - if(map_zoom) - map.setView(new L.LatLng(map_lat, map_lon),map_zoom); - else - map.setView(new L.LatLng(map_lat, map_lon),8); - } - - map.addLayer(osmMapnik); - - var baseLayers = { - "OSM Mapnik": osmMapnik/*, - "OSM Wikimedia": osmWikimedia*/ - }; - - L.control.layers(baseLayers).addTo(map); - - - if(map_geojson) - L.geoJson(map_geojson).addTo(map); - /*else if(map_bounds) - L.rectangle(map_bounds, {color: "#ff7800", weight: 3, fill:false}).addTo(map);*/ - }); - - // this event occour only once per element - $( this ).off( event ); - }); -}); +;/** + * searx is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * searx is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with searx. If not, see < http://www.gnu.org/licenses/ >. + * + * (C) 2014 by Thomas Pointhuber, + */ + +if(searx.autocompleter) { + searx.searchResults = new Bloodhound({ + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), + queryTokenizer: Bloodhound.tokenizers.whitespace, + remote: './autocompleter?q=%QUERY' + }); + searx.searchResults.initialize(); +} + +$(document).ready(function(){ + if(searx.autocompleter) { + $('#q').typeahead(null, { + name: 'search-results', + displayKey: function(result) { + return result; + }, + source: searx.searchResults.ttAdapter() + }); + } +}); +;/** + * searx is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * searx is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with searx. If not, see < http://www.gnu.org/licenses/ >. + * + * (C) 2014 by Thomas Pointhuber, + */ + +$(document).ready(function(){ + /** + * focus element if class="autofocus" and id="q" + */ + $('#q.autofocus').focus(); + + /** + * select full content on click if class="select-all-on-click" + */ + $(".select-all-on-click").click(function () { + $(this).select(); + }); + + /** + * change text during btn-collapse click if possible + */ + $('.btn-collapse').click(function() { + var btnTextCollapsed = $(this).data('btn-text-collapsed'); + var btnTextNotCollapsed = $(this).data('btn-text-not-collapsed'); + + if(btnTextCollapsed !== '' && btnTextNotCollapsed !== '') { + if($(this).hasClass('collapsed')) { + new_html = $(this).html().replace(btnTextCollapsed, btnTextNotCollapsed); + } else { + new_html = $(this).html().replace(btnTextNotCollapsed, btnTextCollapsed); + } + $(this).html(new_html); + } + }); + + /** + * change text during btn-toggle click if possible + */ + $('.btn-toggle .btn').click(function() { + var btnClass = 'btn-' + $(this).data('btn-class'); + var btnLabelDefault = $(this).data('btn-label-default'); + var btnLabelToggled = $(this).data('btn-label-toggled'); + if(btnLabelToggled !== '') { + if($(this).hasClass('btn-default')) { + new_html = $(this).html().replace(btnLabelDefault, btnLabelToggled); + } else { + new_html = $(this).html().replace(btnLabelToggled, btnLabelDefault); + } + $(this).html(new_html); + } + $(this).toggleClass(btnClass); + $(this).toggleClass('btn-default'); + }); + + /** + * change text during btn-toggle click if possible + */ + $('.media-loader').click(function() { + var target = $(this).data('target'); + var iframe_load = $(target + ' > iframe'); + var srctest = iframe_load.attr('src'); + if(srctest === undefined || srctest === false){ + iframe_load.attr('src', iframe_load.data('src')); + } + }); + + /** + * Select or deselect every categories on double clic + */ + $(".btn-sm").dblclick(function() { + var btnClass = 'btn-' + $(this).data('btn-class'); // primary + if($(this).hasClass('btn-default')) { + $(".btn-sm > input").attr('checked', 'checked'); + $(".btn-sm > input").prop("checked", true); + $(".btn-sm").addClass(btnClass); + $(".btn-sm").addClass('active'); + $(".btn-sm").removeClass('btn-default'); + } else { + $(".btn-sm > input").attr('checked', ''); + $(".btn-sm > input").removeAttr('checked'); + $(".btn-sm > input").checked = false; + $(".btn-sm").removeClass(btnClass); + $(".btn-sm").removeClass('active'); + $(".btn-sm").addClass('btn-default'); + } + }); +}); +;/** + * searx is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * searx is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with searx. If not, see < http://www.gnu.org/licenses/ >. + * + * (C) 2014 by Thomas Pointhuber, + */ + +$(document).ready(function(){ + $(".searx_overpass_request").on( "click", function( event ) { + var overpass_url = "https://overpass-api.de/api/interpreter?data="; + var query_start = overpass_url + "[out:json][timeout:25];("; + var query_end = ");out meta;"; + + var osm_id = $(this).data('osm-id'); + var osm_type = $(this).data('osm-type'); + var result_table = $(this).data('result-table'); + var result_table_loadicon = "#" + $(this).data('result-table-loadicon'); + + // tags which can be ignored + var osm_ignore_tags = [ "addr:city", "addr:country", "addr:housenumber", "addr:postcode", "addr:street" ]; + + if(osm_id && osm_type && result_table) { + result_table = "#" + result_table; + var query = null; + switch(osm_type) { + case 'node': + query = query_start + "node(" + osm_id + ");" + query_end; + break; + case 'way': + query = query_start + "way(" + osm_id + ");" + query_end; + break; + case 'relation': + query = query_start + "relation(" + osm_id + ");" + query_end; + break; + default: + break; + } + if(query) { + //alert(query); + var ajaxRequest = $.ajax( query ) + .done(function( html) { + if(html && html.elements && html.elements[0]) { + var element = html.elements[0]; + var newHtml = $(result_table).html(); + for (var row in element.tags) { + if(element.tags.name === null || osm_ignore_tags.indexOf(row) == -1) { + newHtml += "
"; + } + } + $(result_table).html(newHtml); + $(result_table).removeClass('hidden'); + $(result_table_loadicon).addClass('hidden'); + } + }) + .fail(function() { + $(result_table_loadicon).html($(result_table_loadicon).html() + "

could not load data!

"); + }); + } + } + + // this event occour only once per element + $( this ).off( event ); + }); + + $(".searx_init_map").on( "click", function( event ) { + var leaflet_target = $(this).data('leaflet-target'); + var map_lon = $(this).data('map-lon'); + var map_lat = $(this).data('map-lat'); + var map_zoom = $(this).data('map-zoom'); + var map_boundingbox = $(this).data('map-boundingbox'); + var map_geojson = $(this).data('map-geojson'); + + require(['leaflet-0.7.3.min'], function(leaflet) { + if(map_boundingbox) { + southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]); + northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]); + map_bounds = L.latLngBounds(southWest, northEast); + } + + // TODO hack + // change default imagePath + L.Icon.Default.imagePath = "./static/themes/oscar/img/map"; + + // init map + var map = L.map(leaflet_target); + + // create the tile layer with correct attribution + var osmMapnikUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; + var osmMapnikAttrib='Map data © OpenStreetMap contributors'; + var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib}); + + var osmWikimediaUrl='https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png'; + var osmWikimediaAttrib = 'Wikimedia maps beta | Maps data © OpenStreetMap contributors'; + var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib}); + + // init map view + if(map_bounds) { + // TODO hack: https://github.com/Leaflet/Leaflet/issues/2021 + setTimeout(function () { + map.fitBounds(map_bounds, { + maxZoom:17 + }); + }, 0); + } else if (map_lon && map_lat) { + if(map_zoom) + map.setView(new L.LatLng(map_lat, map_lon),map_zoom); + else + map.setView(new L.LatLng(map_lat, map_lon),8); + } + + map.addLayer(osmMapnik); + + var baseLayers = { + "OSM Mapnik": osmMapnik/*, + "OSM Wikimedia": osmWikimedia*/ + }; + + L.control.layers(baseLayers).addTo(map); + + + if(map_geojson) + L.geoJson(map_geojson).addTo(map); + /*else if(map_bounds) + L.rectangle(map_bounds, {color: "#ff7800", weight: 3, fill:false}).addTo(map);*/ + }); + + // this event occour only once per element + $( this ).off( event ); + }); +}); diff --git a/searx/static/themes/oscar/js/searx_src/00_requirejs_config.js b/searx/static/themes/oscar/js/searx_src/00_requirejs_config.js index 1aa434902..e7c2abdac 100644 --- a/searx/static/themes/oscar/js/searx_src/00_requirejs_config.js +++ b/searx/static/themes/oscar/js/searx_src/00_requirejs_config.js @@ -1,23 +1,23 @@ -/** - * searx is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * searx is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with searx. If not, see < http://www.gnu.org/licenses/ >. - * - * (C) 2014 by Thomas Pointhuber, - */ - -requirejs.config({ - baseUrl: './static/themes/oscar/js', - paths: { - app: '../app' - } -}); +/** + * searx is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * searx is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with searx. If not, see < http://www.gnu.org/licenses/ >. + * + * (C) 2014 by Thomas Pointhuber, + */ + +requirejs.config({ + baseUrl: './static/themes/oscar/js', + paths: { + app: '../app' + } +}); diff --git a/searx/static/themes/oscar/js/searx_src/autocompleter.js b/searx/static/themes/oscar/js/searx_src/autocompleter.js index 70c66d2fc..0907f8e34 100644 --- a/searx/static/themes/oscar/js/searx_src/autocompleter.js +++ b/searx/static/themes/oscar/js/searx_src/autocompleter.js @@ -1,37 +1,37 @@ -/** - * searx is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * searx is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with searx. If not, see < http://www.gnu.org/licenses/ >. - * - * (C) 2014 by Thomas Pointhuber, - */ - -if(searx.autocompleter) { - searx.searchResults = new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), - queryTokenizer: Bloodhound.tokenizers.whitespace, - remote: './autocompleter?q=%QUERY' - }); - searx.searchResults.initialize(); -} - -$(document).ready(function(){ - if(searx.autocompleter) { - $('#q').typeahead(null, { - name: 'search-results', - displayKey: function(result) { - return result; - }, - source: searx.searchResults.ttAdapter() - }); - } -}); +/** + * searx is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * searx is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with searx. If not, see < http://www.gnu.org/licenses/ >. + * + * (C) 2014 by Thomas Pointhuber, + */ + +if(searx.autocompleter) { + searx.searchResults = new Bloodhound({ + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), + queryTokenizer: Bloodhound.tokenizers.whitespace, + remote: './autocompleter?q=%QUERY' + }); + searx.searchResults.initialize(); +} + +$(document).ready(function(){ + if(searx.autocompleter) { + $('#q').typeahead(null, { + name: 'search-results', + displayKey: function(result) { + return result; + }, + source: searx.searchResults.ttAdapter() + }); + } +}); diff --git a/searx/static/themes/oscar/js/searx_src/element_modifiers.js b/searx/static/themes/oscar/js/searx_src/element_modifiers.js index 8e4280548..4264d4c0d 100644 --- a/searx/static/themes/oscar/js/searx_src/element_modifiers.js +++ b/searx/static/themes/oscar/js/searx_src/element_modifiers.js @@ -1,99 +1,99 @@ -/** - * searx is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * searx is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with searx. If not, see < http://www.gnu.org/licenses/ >. - * - * (C) 2014 by Thomas Pointhuber, - */ - -$(document).ready(function(){ - /** - * focus element if class="autofocus" and id="q" - */ - $('#q.autofocus').focus(); - - /** - * select full content on click if class="select-all-on-click" - */ - $(".select-all-on-click").click(function () { - $(this).select(); - }); - - /** - * change text during btn-collapse click if possible - */ - $('.btn-collapse').click(function() { - var btnTextCollapsed = $(this).data('btn-text-collapsed'); - var btnTextNotCollapsed = $(this).data('btn-text-not-collapsed'); - - if(btnTextCollapsed !== '' && btnTextNotCollapsed !== '') { - if($(this).hasClass('collapsed')) { - new_html = $(this).html().replace(btnTextCollapsed, btnTextNotCollapsed); - } else { - new_html = $(this).html().replace(btnTextNotCollapsed, btnTextCollapsed); - } - $(this).html(new_html); - } - }); - - /** - * change text during btn-toggle click if possible - */ - $('.btn-toggle .btn').click(function() { - var btnClass = 'btn-' + $(this).data('btn-class'); - var btnLabelDefault = $(this).data('btn-label-default'); - var btnLabelToggled = $(this).data('btn-label-toggled'); - if(btnLabelToggled !== '') { - if($(this).hasClass('btn-default')) { - new_html = $(this).html().replace(btnLabelDefault, btnLabelToggled); - } else { - new_html = $(this).html().replace(btnLabelToggled, btnLabelDefault); - } - $(this).html(new_html); - } - $(this).toggleClass(btnClass); - $(this).toggleClass('btn-default'); - }); - - /** - * change text during btn-toggle click if possible - */ - $('.media-loader').click(function() { - var target = $(this).data('target'); - var iframe_load = $(target + ' > iframe'); - var srctest = iframe_load.attr('src'); - if(srctest === undefined || srctest === false){ - iframe_load.attr('src', iframe_load.data('src')); - } - }); - - /** - * Select or deselect every categories on double clic - */ - $(".btn-sm").dblclick(function() { - var btnClass = 'btn-' + $(this).data('btn-class'); // primary - if($(this).hasClass('btn-default')) { - $(".btn-sm > input").attr('checked', 'checked'); - $(".btn-sm > input").prop("checked", true); - $(".btn-sm").addClass(btnClass); - $(".btn-sm").addClass('active'); - $(".btn-sm").removeClass('btn-default'); - } else { - $(".btn-sm > input").attr('checked', ''); - $(".btn-sm > input").removeAttr('checked'); - $(".btn-sm > input").checked = false; - $(".btn-sm").removeClass(btnClass); - $(".btn-sm").removeClass('active'); - $(".btn-sm").addClass('btn-default'); - } - }); -}); +/** + * searx is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * searx is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with searx. If not, see < http://www.gnu.org/licenses/ >. + * + * (C) 2014 by Thomas Pointhuber, + */ + +$(document).ready(function(){ + /** + * focus element if class="autofocus" and id="q" + */ + $('#q.autofocus').focus(); + + /** + * select full content on click if class="select-all-on-click" + */ + $(".select-all-on-click").click(function () { + $(this).select(); + }); + + /** + * change text during btn-collapse click if possible + */ + $('.btn-collapse').click(function() { + var btnTextCollapsed = $(this).data('btn-text-collapsed'); + var btnTextNotCollapsed = $(this).data('btn-text-not-collapsed'); + + if(btnTextCollapsed !== '' && btnTextNotCollapsed !== '') { + if($(this).hasClass('collapsed')) { + new_html = $(this).html().replace(btnTextCollapsed, btnTextNotCollapsed); + } else { + new_html = $(this).html().replace(btnTextNotCollapsed, btnTextCollapsed); + } + $(this).html(new_html); + } + }); + + /** + * change text during btn-toggle click if possible + */ + $('.btn-toggle .btn').click(function() { + var btnClass = 'btn-' + $(this).data('btn-class'); + var btnLabelDefault = $(this).data('btn-label-default'); + var btnLabelToggled = $(this).data('btn-label-toggled'); + if(btnLabelToggled !== '') { + if($(this).hasClass('btn-default')) { + new_html = $(this).html().replace(btnLabelDefault, btnLabelToggled); + } else { + new_html = $(this).html().replace(btnLabelToggled, btnLabelDefault); + } + $(this).html(new_html); + } + $(this).toggleClass(btnClass); + $(this).toggleClass('btn-default'); + }); + + /** + * change text during btn-toggle click if possible + */ + $('.media-loader').click(function() { + var target = $(this).data('target'); + var iframe_load = $(target + ' > iframe'); + var srctest = iframe_load.attr('src'); + if(srctest === undefined || srctest === false){ + iframe_load.attr('src', iframe_load.data('src')); + } + }); + + /** + * Select or deselect every categories on double clic + */ + $(".btn-sm").dblclick(function() { + var btnClass = 'btn-' + $(this).data('btn-class'); // primary + if($(this).hasClass('btn-default')) { + $(".btn-sm > input").attr('checked', 'checked'); + $(".btn-sm > input").prop("checked", true); + $(".btn-sm").addClass(btnClass); + $(".btn-sm").addClass('active'); + $(".btn-sm").removeClass('btn-default'); + } else { + $(".btn-sm > input").attr('checked', ''); + $(".btn-sm > input").removeAttr('checked'); + $(".btn-sm > input").checked = false; + $(".btn-sm").removeClass(btnClass); + $(".btn-sm").removeClass('active'); + $(".btn-sm").addClass('btn-default'); + } + }); +}); diff --git a/searx/static/themes/oscar/js/searx_src/leaflet_map.js b/searx/static/themes/oscar/js/searx_src/leaflet_map.js index 4be46acb5..3c8c616b1 100644 --- a/searx/static/themes/oscar/js/searx_src/leaflet_map.js +++ b/searx/static/themes/oscar/js/searx_src/leaflet_map.js @@ -1,167 +1,167 @@ -/** - * searx is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * searx is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with searx. If not, see < http://www.gnu.org/licenses/ >. - * - * (C) 2014 by Thomas Pointhuber, - */ - -$(document).ready(function(){ - $(".searx_overpass_request").on( "click", function( event ) { - var overpass_url = "https://overpass-api.de/api/interpreter?data="; - var query_start = overpass_url + "[out:json][timeout:25];("; - var query_end = ");out meta;"; - - var osm_id = $(this).data('osm-id'); - var osm_type = $(this).data('osm-type'); - var result_table = $(this).data('result-table'); - var result_table_loadicon = "#" + $(this).data('result-table-loadicon'); - - // tags which can be ignored - var osm_ignore_tags = [ "addr:city", "addr:country", "addr:housenumber", "addr:postcode", "addr:street" ]; - - if(osm_id && osm_type && result_table) { - result_table = "#" + result_table; - var query = null; - switch(osm_type) { - case 'node': - query = query_start + "node(" + osm_id + ");" + query_end; - break; - case 'way': - query = query_start + "way(" + osm_id + ");" + query_end; - break; - case 'relation': - query = query_start + "relation(" + osm_id + ");" + query_end; - break; - default: - break; - } - if(query) { - //alert(query); - var ajaxRequest = $.ajax( query ) - .done(function( html) { - if(html && html.elements && html.elements[0]) { - var element = html.elements[0]; - var newHtml = $(result_table).html(); - for (var row in element.tags) { - if(element.tags.name === null || osm_ignore_tags.indexOf(row) == -1) { - newHtml += ""; - } - } - $(result_table).html(newHtml); - $(result_table).removeClass('hidden'); - $(result_table_loadicon).addClass('hidden'); - } - }) - .fail(function() { - $(result_table_loadicon).html($(result_table_loadicon).html() + "

could not load data!

"); - }); - } - } - - // this event occour only once per element - $( this ).off( event ); - }); - - $(".searx_init_map").on( "click", function( event ) { - var leaflet_target = $(this).data('leaflet-target'); - var map_lon = $(this).data('map-lon'); - var map_lat = $(this).data('map-lat'); - var map_zoom = $(this).data('map-zoom'); - var map_boundingbox = $(this).data('map-boundingbox'); - var map_geojson = $(this).data('map-geojson'); - - require(['leaflet-0.7.3.min'], function(leaflet) { - if(map_boundingbox) { - southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]); - northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]); - map_bounds = L.latLngBounds(southWest, northEast); - } - - // TODO hack - // change default imagePath - L.Icon.Default.imagePath = "./static/themes/oscar/img/map"; - - // init map - var map = L.map(leaflet_target); - - // create the tile layer with correct attribution - var osmMapnikUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; - var osmMapnikAttrib='Map data © OpenStreetMap contributors'; - var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib}); - - var osmWikimediaUrl='https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png'; - var osmWikimediaAttrib = 'Wikimedia maps beta | Maps data © OpenStreetMap contributors'; - var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib}); - - // init map view - if(map_bounds) { - // TODO hack: https://github.com/Leaflet/Leaflet/issues/2021 - setTimeout(function () { - map.fitBounds(map_bounds, { - maxZoom:17 - }); - }, 0); - } else if (map_lon && map_lat) { - if(map_zoom) - map.setView(new L.LatLng(map_lat, map_lon),map_zoom); - else - map.setView(new L.LatLng(map_lat, map_lon),8); - } - - map.addLayer(osmMapnik); - - var baseLayers = { - "OSM Mapnik": osmMapnik/*, - "OSM Wikimedia": osmWikimedia*/ - }; - - L.control.layers(baseLayers).addTo(map); - - - if(map_geojson) - L.geoJson(map_geojson).addTo(map); - /*else if(map_bounds) - L.rectangle(map_bounds, {color: "#ff7800", weight: 3, fill:false}).addTo(map);*/ - }); - - // this event occour only once per element - $( this ).off( event ); - }); -}); +/** + * searx is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * searx is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with searx. If not, see < http://www.gnu.org/licenses/ >. + * + * (C) 2014 by Thomas Pointhuber, + */ + +$(document).ready(function(){ + $(".searx_overpass_request").on( "click", function( event ) { + var overpass_url = "https://overpass-api.de/api/interpreter?data="; + var query_start = overpass_url + "[out:json][timeout:25];("; + var query_end = ");out meta;"; + + var osm_id = $(this).data('osm-id'); + var osm_type = $(this).data('osm-type'); + var result_table = $(this).data('result-table'); + var result_table_loadicon = "#" + $(this).data('result-table-loadicon'); + + // tags which can be ignored + var osm_ignore_tags = [ "addr:city", "addr:country", "addr:housenumber", "addr:postcode", "addr:street" ]; + + if(osm_id && osm_type && result_table) { + result_table = "#" + result_table; + var query = null; + switch(osm_type) { + case 'node': + query = query_start + "node(" + osm_id + ");" + query_end; + break; + case 'way': + query = query_start + "way(" + osm_id + ");" + query_end; + break; + case 'relation': + query = query_start + "relation(" + osm_id + ");" + query_end; + break; + default: + break; + } + if(query) { + //alert(query); + var ajaxRequest = $.ajax( query ) + .done(function( html) { + if(html && html.elements && html.elements[0]) { + var element = html.elements[0]; + var newHtml = $(result_table).html(); + for (var row in element.tags) { + if(element.tags.name === null || osm_ignore_tags.indexOf(row) == -1) { + newHtml += ""; + } + } + $(result_table).html(newHtml); + $(result_table).removeClass('hidden'); + $(result_table_loadicon).addClass('hidden'); + } + }) + .fail(function() { + $(result_table_loadicon).html($(result_table_loadicon).html() + "

could not load data!

"); + }); + } + } + + // this event occour only once per element + $( this ).off( event ); + }); + + $(".searx_init_map").on( "click", function( event ) { + var leaflet_target = $(this).data('leaflet-target'); + var map_lon = $(this).data('map-lon'); + var map_lat = $(this).data('map-lat'); + var map_zoom = $(this).data('map-zoom'); + var map_boundingbox = $(this).data('map-boundingbox'); + var map_geojson = $(this).data('map-geojson'); + + require(['leaflet-0.7.3.min'], function(leaflet) { + if(map_boundingbox) { + southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]); + northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]); + map_bounds = L.latLngBounds(southWest, northEast); + } + + // TODO hack + // change default imagePath + L.Icon.Default.imagePath = "./static/themes/oscar/img/map"; + + // init map + var map = L.map(leaflet_target); + + // create the tile layer with correct attribution + var osmMapnikUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; + var osmMapnikAttrib='Map data © OpenStreetMap contributors'; + var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib}); + + var osmWikimediaUrl='https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png'; + var osmWikimediaAttrib = 'Wikimedia maps beta | Maps data © OpenStreetMap contributors'; + var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib}); + + // init map view + if(map_bounds) { + // TODO hack: https://github.com/Leaflet/Leaflet/issues/2021 + setTimeout(function () { + map.fitBounds(map_bounds, { + maxZoom:17 + }); + }, 0); + } else if (map_lon && map_lat) { + if(map_zoom) + map.setView(new L.LatLng(map_lat, map_lon),map_zoom); + else + map.setView(new L.LatLng(map_lat, map_lon),8); + } + + map.addLayer(osmMapnik); + + var baseLayers = { + "OSM Mapnik": osmMapnik/*, + "OSM Wikimedia": osmWikimedia*/ + }; + + L.control.layers(baseLayers).addTo(map); + + + if(map_geojson) + L.geoJson(map_geojson).addTo(map); + /*else if(map_bounds) + L.rectangle(map_bounds, {color: "#ff7800", weight: 3, fill:false}).addTo(map);*/ + }); + + // this event occour only once per element + $( this ).off( event ); + }); +}); diff --git a/searx/static/themes/oscar/less/logicodev-dark/oscar.less b/searx/static/themes/oscar/less/logicodev-dark/oscar.less index 9a4272331..e788b8cba 100644 --- a/searx/static/themes/oscar/less/logicodev-dark/oscar.less +++ b/searx/static/themes/oscar/less/logicodev-dark/oscar.less @@ -109,7 +109,7 @@ ul.nav li a { .btn:hover { color:#444 !important; - background-color: #BBB !important; + background-color: #BBB !important; } .btn-primary.active { @@ -221,7 +221,7 @@ p.btn.btn-default{ } .table-hover > tbody > tr:hover > td, .table-hover > tbody > tr:hover > th { - background: rgb(102, 105, 110) !important; + background: rgb(102, 105, 110) !important; } .btn-success { diff --git a/searx/static/themes/oscar/less/logicodev/code.less b/searx/static/themes/oscar/less/logicodev/code.less index 96486f5aa..491b30e5a 100644 --- a/searx/static/themes/oscar/less/logicodev/code.less +++ b/searx/static/themes/oscar/less/logicodev/code.less @@ -78,7 +78,7 @@ pre, code{ user-select: none; cursor: default; color: #556366; - + &::selection { background: transparent; /* WebKit/Blink Browsers */ } @@ -99,5 +99,3 @@ pre, code{ .highlight { font-weight: 700; } - - diff --git a/searx/static/themes/oscar/less/logicodev/infobox.less b/searx/static/themes/oscar/less/logicodev/infobox.less index 0d488d744..954f4507a 100644 --- a/searx/static/themes/oscar/less/logicodev/infobox.less +++ b/searx/static/themes/oscar/less/logicodev/infobox.less @@ -30,7 +30,7 @@ table-layout: fixed; } - + .infobox_part:last-child { margin-bottom: 0; } diff --git a/searx/static/themes/oscar/less/logicodev/navbar.less b/searx/static/themes/oscar/less/logicodev/navbar.less index 5da7115d9..6e4f9ee10 100644 --- a/searx/static/themes/oscar/less/logicodev/navbar.less +++ b/searx/static/themes/oscar/less/logicodev/navbar.less @@ -28,4 +28,3 @@ width: 80%; } } - diff --git a/searx/static/themes/oscar/less/pointhi/code.less b/searx/static/themes/oscar/less/pointhi/code.less index 90a2cd60c..70a2a5d49 100644 --- a/searx/static/themes/oscar/less/pointhi/code.less +++ b/searx/static/themes/oscar/less/pointhi/code.less @@ -69,7 +69,7 @@ -ms-user-select: none; user-select: none; cursor: default; - + &::selection { background: transparent; /* WebKit/Blink Browsers */ } diff --git a/searx/static/themes/oscar/less/pointhi/infobox.less b/searx/static/themes/oscar/less/pointhi/infobox.less index 41375f277..df51b002e 100644 --- a/searx/static/themes/oscar/less/pointhi/infobox.less +++ b/searx/static/themes/oscar/less/pointhi/infobox.less @@ -4,7 +4,7 @@ word-wrap: break-word; table-layout: fixed; } - + .infobox_part:last-child { margin-bottom: 0; } diff --git a/searx/static/themes/simple/leaflet/leaflet.css b/searx/static/themes/simple/leaflet/leaflet.css index 230e5bad1..d1b47a125 100644 --- a/searx/static/themes/simple/leaflet/leaflet.css +++ b/searx/static/themes/simple/leaflet/leaflet.css @@ -1,636 +1,636 @@ -/* required styles */ - -.leaflet-pane, -.leaflet-tile, -.leaflet-marker-icon, -.leaflet-marker-shadow, -.leaflet-tile-container, -.leaflet-pane > svg, -.leaflet-pane > canvas, -.leaflet-zoom-box, -.leaflet-image-layer, -.leaflet-layer { - position: absolute; - left: 0; - top: 0; - } -.leaflet-container { - overflow: hidden; - } -.leaflet-tile, -.leaflet-marker-icon, -.leaflet-marker-shadow { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; - -webkit-user-drag: none; - } -/* Safari renders non-retina tile on retina better with this, but Chrome is worse */ -.leaflet-safari .leaflet-tile { - image-rendering: -webkit-optimize-contrast; - } -/* hack that prevents hw layers "stretching" when loading new tiles */ -.leaflet-safari .leaflet-tile-container { - width: 1600px; - height: 1600px; - -webkit-transform-origin: 0 0; - } -.leaflet-marker-icon, -.leaflet-marker-shadow { - display: block; - } -/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */ -/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */ -.leaflet-container .leaflet-overlay-pane svg, -.leaflet-container .leaflet-marker-pane img, -.leaflet-container .leaflet-shadow-pane img, -.leaflet-container .leaflet-tile-pane img, -.leaflet-container img.leaflet-image-layer { - max-width: none !important; - max-height: none !important; - } - -.leaflet-container.leaflet-touch-zoom { - -ms-touch-action: pan-x pan-y; - touch-action: pan-x pan-y; - } -.leaflet-container.leaflet-touch-drag { - -ms-touch-action: pinch-zoom; - /* Fallback for FF which doesn't support pinch-zoom */ - touch-action: none; - touch-action: pinch-zoom; -} -.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom { - -ms-touch-action: none; - touch-action: none; -} -.leaflet-container { - -webkit-tap-highlight-color: transparent; -} -.leaflet-container a { - -webkit-tap-highlight-color: rgba(51, 181, 229, 0.4); -} -.leaflet-tile { - filter: inherit; - visibility: hidden; - } -.leaflet-tile-loaded { - visibility: inherit; - } -.leaflet-zoom-box { - width: 0; - height: 0; - -moz-box-sizing: border-box; - box-sizing: border-box; - z-index: 800; - } -/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ -.leaflet-overlay-pane svg { - -moz-user-select: none; - } - -.leaflet-pane { z-index: 400; } - -.leaflet-tile-pane { z-index: 200; } -.leaflet-overlay-pane { z-index: 400; } -.leaflet-shadow-pane { z-index: 500; } -.leaflet-marker-pane { z-index: 600; } -.leaflet-tooltip-pane { z-index: 650; } -.leaflet-popup-pane { z-index: 700; } - -.leaflet-map-pane canvas { z-index: 100; } -.leaflet-map-pane svg { z-index: 200; } - -.leaflet-vml-shape { - width: 1px; - height: 1px; - } -.lvml { - behavior: url(#default#VML); - display: inline-block; - position: absolute; - } - - -/* control positioning */ - -.leaflet-control { - position: relative; - z-index: 800; - pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ - pointer-events: auto; - } -.leaflet-top, -.leaflet-bottom { - position: absolute; - z-index: 1000; - pointer-events: none; - } -.leaflet-top { - top: 0; - } -.leaflet-right { - right: 0; - } -.leaflet-bottom { - bottom: 0; - } -.leaflet-left { - left: 0; - } -.leaflet-control { - float: left; - clear: both; - } -.leaflet-right .leaflet-control { - float: right; - } -.leaflet-top .leaflet-control { - margin-top: 10px; - } -.leaflet-bottom .leaflet-control { - margin-bottom: 10px; - } -.leaflet-left .leaflet-control { - margin-left: 10px; - } -.leaflet-right .leaflet-control { - margin-right: 10px; - } - - -/* zoom and fade animations */ - -.leaflet-fade-anim .leaflet-tile { - will-change: opacity; - } -.leaflet-fade-anim .leaflet-popup { - opacity: 0; - -webkit-transition: opacity 0.2s linear; - -moz-transition: opacity 0.2s linear; - -o-transition: opacity 0.2s linear; - transition: opacity 0.2s linear; - } -.leaflet-fade-anim .leaflet-map-pane .leaflet-popup { - opacity: 1; - } -.leaflet-zoom-animated { - -webkit-transform-origin: 0 0; - -ms-transform-origin: 0 0; - transform-origin: 0 0; - } -.leaflet-zoom-anim .leaflet-zoom-animated { - will-change: transform; - } -.leaflet-zoom-anim .leaflet-zoom-animated { - -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); - -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); - -o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1); - transition: transform 0.25s cubic-bezier(0,0,0.25,1); - } -.leaflet-zoom-anim .leaflet-tile, -.leaflet-pan-anim .leaflet-tile { - -webkit-transition: none; - -moz-transition: none; - -o-transition: none; - transition: none; - } - -.leaflet-zoom-anim .leaflet-zoom-hide { - visibility: hidden; - } - - -/* cursors */ - -.leaflet-interactive { - cursor: pointer; - } -.leaflet-grab { - cursor: -webkit-grab; - cursor: -moz-grab; - } -.leaflet-crosshair, -.leaflet-crosshair .leaflet-interactive { - cursor: crosshair; - } -.leaflet-popup-pane, -.leaflet-control { - cursor: auto; - } -.leaflet-dragging .leaflet-grab, -.leaflet-dragging .leaflet-grab .leaflet-interactive, -.leaflet-dragging .leaflet-marker-draggable { - cursor: move; - cursor: -webkit-grabbing; - cursor: -moz-grabbing; - } - -/* marker & overlays interactivity */ -.leaflet-marker-icon, -.leaflet-marker-shadow, -.leaflet-image-layer, -.leaflet-pane > svg path, -.leaflet-tile-container { - pointer-events: none; - } - -.leaflet-marker-icon.leaflet-interactive, -.leaflet-image-layer.leaflet-interactive, -.leaflet-pane > svg path.leaflet-interactive { - pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ - pointer-events: auto; - } - -/* visual tweaks */ - -.leaflet-container { - background: #ddd; - outline: 0; - } -.leaflet-container a { - color: #0078A8; - } -.leaflet-container a.leaflet-active { - outline: 2px solid orange; - } -.leaflet-zoom-box { - border: 2px dotted #38f; - background: rgba(255,255,255,0.5); - } - - -/* general typography */ -.leaflet-container { - font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; - } - - -/* general toolbar styles */ - -.leaflet-bar { - box-shadow: 0 1px 5px rgba(0,0,0,0.65); - border-radius: 4px; - } -.leaflet-bar a, -.leaflet-bar a:hover { - background-color: #fff; - border-bottom: 1px solid #ccc; - width: 26px; - height: 26px; - line-height: 26px; - display: block; - text-align: center; - text-decoration: none; - color: black; - } -.leaflet-bar a, -.leaflet-control-layers-toggle { - background-position: 50% 50%; - background-repeat: no-repeat; - display: block; - } -.leaflet-bar a:hover { - background-color: #f4f4f4; - } -.leaflet-bar a:first-child { - border-top-left-radius: 4px; - border-top-right-radius: 4px; - } -.leaflet-bar a:last-child { - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; - border-bottom: none; - } -.leaflet-bar a.leaflet-disabled { - cursor: default; - background-color: #f4f4f4; - color: #bbb; - } - -.leaflet-touch .leaflet-bar a { - width: 30px; - height: 30px; - line-height: 30px; - } -.leaflet-touch .leaflet-bar a:first-child { - border-top-left-radius: 2px; - border-top-right-radius: 2px; - } -.leaflet-touch .leaflet-bar a:last-child { - border-bottom-left-radius: 2px; - border-bottom-right-radius: 2px; - } - -/* zoom control */ - -.leaflet-control-zoom-in, -.leaflet-control-zoom-out { - font: bold 18px 'Lucida Console', Monaco, monospace; - text-indent: 1px; - } - -.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out { - font-size: 22px; - } - - -/* layers control */ - -.leaflet-control-layers { - box-shadow: 0 1px 5px rgba(0,0,0,0.4); - background: #fff; - border-radius: 5px; - } -.leaflet-control-layers-toggle { - background-image: url(images/layers.png); - width: 36px; - height: 36px; - } -.leaflet-retina .leaflet-control-layers-toggle { - background-image: url(images/layers-2x.png); - background-size: 26px 26px; - } -.leaflet-touch .leaflet-control-layers-toggle { - width: 44px; - height: 44px; - } -.leaflet-control-layers .leaflet-control-layers-list, -.leaflet-control-layers-expanded .leaflet-control-layers-toggle { - display: none; - } -.leaflet-control-layers-expanded .leaflet-control-layers-list { - display: block; - position: relative; - } -.leaflet-control-layers-expanded { - padding: 6px 10px 6px 6px; - color: #333; - background: #fff; - } -.leaflet-control-layers-scrollbar { - overflow-y: scroll; - overflow-x: hidden; - padding-right: 5px; - } -.leaflet-control-layers-selector { - margin-top: 2px; - position: relative; - top: 1px; - } -.leaflet-control-layers label { - display: block; - } -.leaflet-control-layers-separator { - height: 0; - border-top: 1px solid #ddd; - margin: 5px -10px 5px -6px; - } - -/* Default icon URLs */ -.leaflet-default-icon-path { - background-image: url(images/marker-icon.png); - } - - -/* attribution and scale controls */ - -.leaflet-container .leaflet-control-attribution { - background: #fff; - background: rgba(255, 255, 255, 0.7); - margin: 0; - } -.leaflet-control-attribution, -.leaflet-control-scale-line { - padding: 0 5px; - color: #333; - } -.leaflet-control-attribution a { - text-decoration: none; - } -.leaflet-control-attribution a:hover { - text-decoration: underline; - } -.leaflet-container .leaflet-control-attribution, -.leaflet-container .leaflet-control-scale { - font-size: 11px; - } -.leaflet-left .leaflet-control-scale { - margin-left: 5px; - } -.leaflet-bottom .leaflet-control-scale { - margin-bottom: 5px; - } -.leaflet-control-scale-line { - border: 2px solid #777; - border-top: none; - line-height: 1.1; - padding: 2px 5px 1px; - font-size: 11px; - white-space: nowrap; - overflow: hidden; - -moz-box-sizing: border-box; - box-sizing: border-box; - - background: #fff; - background: rgba(255, 255, 255, 0.5); - } -.leaflet-control-scale-line:not(:first-child) { - border-top: 2px solid #777; - border-bottom: none; - margin-top: -2px; - } -.leaflet-control-scale-line:not(:first-child):not(:last-child) { - border-bottom: 2px solid #777; - } - -.leaflet-touch .leaflet-control-attribution, -.leaflet-touch .leaflet-control-layers, -.leaflet-touch .leaflet-bar { - box-shadow: none; - } -.leaflet-touch .leaflet-control-layers, -.leaflet-touch .leaflet-bar { - border: 2px solid rgba(0,0,0,0.2); - background-clip: padding-box; - } - - -/* popup */ - -.leaflet-popup { - position: absolute; - text-align: center; - margin-bottom: 20px; - } -.leaflet-popup-content-wrapper { - padding: 1px; - text-align: left; - border-radius: 12px; - } -.leaflet-popup-content { - margin: 13px 19px; - line-height: 1.4; - } -.leaflet-popup-content p { - margin: 18px 0; - } -.leaflet-popup-tip-container { - width: 40px; - height: 20px; - position: absolute; - left: 50%; - margin-left: -20px; - overflow: hidden; - pointer-events: none; - } -.leaflet-popup-tip { - width: 17px; - height: 17px; - padding: 1px; - - margin: -10px auto 0; - - -webkit-transform: rotate(45deg); - -moz-transform: rotate(45deg); - -ms-transform: rotate(45deg); - -o-transform: rotate(45deg); - transform: rotate(45deg); - } -.leaflet-popup-content-wrapper, -.leaflet-popup-tip { - background: white; - color: #333; - box-shadow: 0 3px 14px rgba(0,0,0,0.4); - } -.leaflet-container a.leaflet-popup-close-button { - position: absolute; - top: 0; - right: 0; - padding: 4px 4px 0 0; - border: none; - text-align: center; - width: 18px; - height: 14px; - font: 16px/14px Tahoma, Verdana, sans-serif; - color: #c3c3c3; - text-decoration: none; - font-weight: bold; - background: transparent; - } -.leaflet-container a.leaflet-popup-close-button:hover { - color: #999; - } -.leaflet-popup-scrolled { - overflow: auto; - border-bottom: 1px solid #ddd; - border-top: 1px solid #ddd; - } - -.leaflet-oldie .leaflet-popup-content-wrapper { - zoom: 1; - } -.leaflet-oldie .leaflet-popup-tip { - width: 24px; - margin: 0 auto; - - -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; - filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); - } -.leaflet-oldie .leaflet-popup-tip-container { - margin-top: -1px; - } - -.leaflet-oldie .leaflet-control-zoom, -.leaflet-oldie .leaflet-control-layers, -.leaflet-oldie .leaflet-popup-content-wrapper, -.leaflet-oldie .leaflet-popup-tip { - border: 1px solid #999; - } - - -/* div icon */ - -.leaflet-div-icon { - background: #fff; - border: 1px solid #666; - } - - -/* Tooltip */ -/* Base styles for the element that has a tooltip */ -.leaflet-tooltip { - position: absolute; - padding: 6px; - background-color: #fff; - border: 1px solid #fff; - border-radius: 3px; - color: #222; - white-space: nowrap; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - pointer-events: none; - box-shadow: 0 1px 3px rgba(0,0,0,0.4); - } -.leaflet-tooltip.leaflet-clickable { - cursor: pointer; - pointer-events: auto; - } -.leaflet-tooltip-top:before, -.leaflet-tooltip-bottom:before, -.leaflet-tooltip-left:before, -.leaflet-tooltip-right:before { - position: absolute; - pointer-events: none; - border: 6px solid transparent; - background: transparent; - content: ""; - } - -/* Directions */ - -.leaflet-tooltip-bottom { - margin-top: 6px; -} -.leaflet-tooltip-top { - margin-top: -6px; -} -.leaflet-tooltip-bottom:before, -.leaflet-tooltip-top:before { - left: 50%; - margin-left: -6px; - } -.leaflet-tooltip-top:before { - bottom: 0; - margin-bottom: -12px; - border-top-color: #fff; - } -.leaflet-tooltip-bottom:before { - top: 0; - margin-top: -12px; - margin-left: -6px; - border-bottom-color: #fff; - } -.leaflet-tooltip-left { - margin-left: -6px; -} -.leaflet-tooltip-right { - margin-left: 6px; -} -.leaflet-tooltip-left:before, -.leaflet-tooltip-right:before { - top: 50%; - margin-top: -6px; - } -.leaflet-tooltip-left:before { - right: 0; - margin-right: -12px; - border-left-color: #fff; - } -.leaflet-tooltip-right:before { - left: 0; - margin-left: -12px; - border-right-color: #fff; - } +/* required styles */ + +.leaflet-pane, +.leaflet-tile, +.leaflet-marker-icon, +.leaflet-marker-shadow, +.leaflet-tile-container, +.leaflet-pane > svg, +.leaflet-pane > canvas, +.leaflet-zoom-box, +.leaflet-image-layer, +.leaflet-layer { + position: absolute; + left: 0; + top: 0; + } +.leaflet-container { + overflow: hidden; + } +.leaflet-tile, +.leaflet-marker-icon, +.leaflet-marker-shadow { + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + -webkit-user-drag: none; + } +/* Safari renders non-retina tile on retina better with this, but Chrome is worse */ +.leaflet-safari .leaflet-tile { + image-rendering: -webkit-optimize-contrast; + } +/* hack that prevents hw layers "stretching" when loading new tiles */ +.leaflet-safari .leaflet-tile-container { + width: 1600px; + height: 1600px; + -webkit-transform-origin: 0 0; + } +.leaflet-marker-icon, +.leaflet-marker-shadow { + display: block; + } +/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */ +/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */ +.leaflet-container .leaflet-overlay-pane svg, +.leaflet-container .leaflet-marker-pane img, +.leaflet-container .leaflet-shadow-pane img, +.leaflet-container .leaflet-tile-pane img, +.leaflet-container img.leaflet-image-layer { + max-width: none !important; + max-height: none !important; + } + +.leaflet-container.leaflet-touch-zoom { + -ms-touch-action: pan-x pan-y; + touch-action: pan-x pan-y; + } +.leaflet-container.leaflet-touch-drag { + -ms-touch-action: pinch-zoom; + /* Fallback for FF which doesn't support pinch-zoom */ + touch-action: none; + touch-action: pinch-zoom; +} +.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom { + -ms-touch-action: none; + touch-action: none; +} +.leaflet-container { + -webkit-tap-highlight-color: transparent; +} +.leaflet-container a { + -webkit-tap-highlight-color: rgba(51, 181, 229, 0.4); +} +.leaflet-tile { + filter: inherit; + visibility: hidden; + } +.leaflet-tile-loaded { + visibility: inherit; + } +.leaflet-zoom-box { + width: 0; + height: 0; + -moz-box-sizing: border-box; + box-sizing: border-box; + z-index: 800; + } +/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ +.leaflet-overlay-pane svg { + -moz-user-select: none; + } + +.leaflet-pane { z-index: 400; } + +.leaflet-tile-pane { z-index: 200; } +.leaflet-overlay-pane { z-index: 400; } +.leaflet-shadow-pane { z-index: 500; } +.leaflet-marker-pane { z-index: 600; } +.leaflet-tooltip-pane { z-index: 650; } +.leaflet-popup-pane { z-index: 700; } + +.leaflet-map-pane canvas { z-index: 100; } +.leaflet-map-pane svg { z-index: 200; } + +.leaflet-vml-shape { + width: 1px; + height: 1px; + } +.lvml { + behavior: url(#default#VML); + display: inline-block; + position: absolute; + } + + +/* control positioning */ + +.leaflet-control { + position: relative; + z-index: 800; + pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ + pointer-events: auto; + } +.leaflet-top, +.leaflet-bottom { + position: absolute; + z-index: 1000; + pointer-events: none; + } +.leaflet-top { + top: 0; + } +.leaflet-right { + right: 0; + } +.leaflet-bottom { + bottom: 0; + } +.leaflet-left { + left: 0; + } +.leaflet-control { + float: left; + clear: both; + } +.leaflet-right .leaflet-control { + float: right; + } +.leaflet-top .leaflet-control { + margin-top: 10px; + } +.leaflet-bottom .leaflet-control { + margin-bottom: 10px; + } +.leaflet-left .leaflet-control { + margin-left: 10px; + } +.leaflet-right .leaflet-control { + margin-right: 10px; + } + + +/* zoom and fade animations */ + +.leaflet-fade-anim .leaflet-tile { + will-change: opacity; + } +.leaflet-fade-anim .leaflet-popup { + opacity: 0; + -webkit-transition: opacity 0.2s linear; + -moz-transition: opacity 0.2s linear; + -o-transition: opacity 0.2s linear; + transition: opacity 0.2s linear; + } +.leaflet-fade-anim .leaflet-map-pane .leaflet-popup { + opacity: 1; + } +.leaflet-zoom-animated { + -webkit-transform-origin: 0 0; + -ms-transform-origin: 0 0; + transform-origin: 0 0; + } +.leaflet-zoom-anim .leaflet-zoom-animated { + will-change: transform; + } +.leaflet-zoom-anim .leaflet-zoom-animated { + -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); + -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); + -o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1); + transition: transform 0.25s cubic-bezier(0,0,0.25,1); + } +.leaflet-zoom-anim .leaflet-tile, +.leaflet-pan-anim .leaflet-tile { + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none; + } + +.leaflet-zoom-anim .leaflet-zoom-hide { + visibility: hidden; + } + + +/* cursors */ + +.leaflet-interactive { + cursor: pointer; + } +.leaflet-grab { + cursor: -webkit-grab; + cursor: -moz-grab; + } +.leaflet-crosshair, +.leaflet-crosshair .leaflet-interactive { + cursor: crosshair; + } +.leaflet-popup-pane, +.leaflet-control { + cursor: auto; + } +.leaflet-dragging .leaflet-grab, +.leaflet-dragging .leaflet-grab .leaflet-interactive, +.leaflet-dragging .leaflet-marker-draggable { + cursor: move; + cursor: -webkit-grabbing; + cursor: -moz-grabbing; + } + +/* marker & overlays interactivity */ +.leaflet-marker-icon, +.leaflet-marker-shadow, +.leaflet-image-layer, +.leaflet-pane > svg path, +.leaflet-tile-container { + pointer-events: none; + } + +.leaflet-marker-icon.leaflet-interactive, +.leaflet-image-layer.leaflet-interactive, +.leaflet-pane > svg path.leaflet-interactive { + pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ + pointer-events: auto; + } + +/* visual tweaks */ + +.leaflet-container { + background: #ddd; + outline: 0; + } +.leaflet-container a { + color: #0078A8; + } +.leaflet-container a.leaflet-active { + outline: 2px solid orange; + } +.leaflet-zoom-box { + border: 2px dotted #38f; + background: rgba(255,255,255,0.5); + } + + +/* general typography */ +.leaflet-container { + font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; + } + + +/* general toolbar styles */ + +.leaflet-bar { + box-shadow: 0 1px 5px rgba(0,0,0,0.65); + border-radius: 4px; + } +.leaflet-bar a, +.leaflet-bar a:hover { + background-color: #fff; + border-bottom: 1px solid #ccc; + width: 26px; + height: 26px; + line-height: 26px; + display: block; + text-align: center; + text-decoration: none; + color: black; + } +.leaflet-bar a, +.leaflet-control-layers-toggle { + background-position: 50% 50%; + background-repeat: no-repeat; + display: block; + } +.leaflet-bar a:hover { + background-color: #f4f4f4; + } +.leaflet-bar a:first-child { + border-top-left-radius: 4px; + border-top-right-radius: 4px; + } +.leaflet-bar a:last-child { + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + border-bottom: none; + } +.leaflet-bar a.leaflet-disabled { + cursor: default; + background-color: #f4f4f4; + color: #bbb; + } + +.leaflet-touch .leaflet-bar a { + width: 30px; + height: 30px; + line-height: 30px; + } +.leaflet-touch .leaflet-bar a:first-child { + border-top-left-radius: 2px; + border-top-right-radius: 2px; + } +.leaflet-touch .leaflet-bar a:last-child { + border-bottom-left-radius: 2px; + border-bottom-right-radius: 2px; + } + +/* zoom control */ + +.leaflet-control-zoom-in, +.leaflet-control-zoom-out { + font: bold 18px 'Lucida Console', Monaco, monospace; + text-indent: 1px; + } + +.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out { + font-size: 22px; + } + + +/* layers control */ + +.leaflet-control-layers { + box-shadow: 0 1px 5px rgba(0,0,0,0.4); + background: #fff; + border-radius: 5px; + } +.leaflet-control-layers-toggle { + background-image: url(images/layers.png); + width: 36px; + height: 36px; + } +.leaflet-retina .leaflet-control-layers-toggle { + background-image: url(images/layers-2x.png); + background-size: 26px 26px; + } +.leaflet-touch .leaflet-control-layers-toggle { + width: 44px; + height: 44px; + } +.leaflet-control-layers .leaflet-control-layers-list, +.leaflet-control-layers-expanded .leaflet-control-layers-toggle { + display: none; + } +.leaflet-control-layers-expanded .leaflet-control-layers-list { + display: block; + position: relative; + } +.leaflet-control-layers-expanded { + padding: 6px 10px 6px 6px; + color: #333; + background: #fff; + } +.leaflet-control-layers-scrollbar { + overflow-y: scroll; + overflow-x: hidden; + padding-right: 5px; + } +.leaflet-control-layers-selector { + margin-top: 2px; + position: relative; + top: 1px; + } +.leaflet-control-layers label { + display: block; + } +.leaflet-control-layers-separator { + height: 0; + border-top: 1px solid #ddd; + margin: 5px -10px 5px -6px; + } + +/* Default icon URLs */ +.leaflet-default-icon-path { + background-image: url(images/marker-icon.png); + } + + +/* attribution and scale controls */ + +.leaflet-container .leaflet-control-attribution { + background: #fff; + background: rgba(255, 255, 255, 0.7); + margin: 0; + } +.leaflet-control-attribution, +.leaflet-control-scale-line { + padding: 0 5px; + color: #333; + } +.leaflet-control-attribution a { + text-decoration: none; + } +.leaflet-control-attribution a:hover { + text-decoration: underline; + } +.leaflet-container .leaflet-control-attribution, +.leaflet-container .leaflet-control-scale { + font-size: 11px; + } +.leaflet-left .leaflet-control-scale { + margin-left: 5px; + } +.leaflet-bottom .leaflet-control-scale { + margin-bottom: 5px; + } +.leaflet-control-scale-line { + border: 2px solid #777; + border-top: none; + line-height: 1.1; + padding: 2px 5px 1px; + font-size: 11px; + white-space: nowrap; + overflow: hidden; + -moz-box-sizing: border-box; + box-sizing: border-box; + + background: #fff; + background: rgba(255, 255, 255, 0.5); + } +.leaflet-control-scale-line:not(:first-child) { + border-top: 2px solid #777; + border-bottom: none; + margin-top: -2px; + } +.leaflet-control-scale-line:not(:first-child):not(:last-child) { + border-bottom: 2px solid #777; + } + +.leaflet-touch .leaflet-control-attribution, +.leaflet-touch .leaflet-control-layers, +.leaflet-touch .leaflet-bar { + box-shadow: none; + } +.leaflet-touch .leaflet-control-layers, +.leaflet-touch .leaflet-bar { + border: 2px solid rgba(0,0,0,0.2); + background-clip: padding-box; + } + + +/* popup */ + +.leaflet-popup { + position: absolute; + text-align: center; + margin-bottom: 20px; + } +.leaflet-popup-content-wrapper { + padding: 1px; + text-align: left; + border-radius: 12px; + } +.leaflet-popup-content { + margin: 13px 19px; + line-height: 1.4; + } +.leaflet-popup-content p { + margin: 18px 0; + } +.leaflet-popup-tip-container { + width: 40px; + height: 20px; + position: absolute; + left: 50%; + margin-left: -20px; + overflow: hidden; + pointer-events: none; + } +.leaflet-popup-tip { + width: 17px; + height: 17px; + padding: 1px; + + margin: -10px auto 0; + + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -ms-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); + } +.leaflet-popup-content-wrapper, +.leaflet-popup-tip { + background: white; + color: #333; + box-shadow: 0 3px 14px rgba(0,0,0,0.4); + } +.leaflet-container a.leaflet-popup-close-button { + position: absolute; + top: 0; + right: 0; + padding: 4px 4px 0 0; + border: none; + text-align: center; + width: 18px; + height: 14px; + font: 16px/14px Tahoma, Verdana, sans-serif; + color: #c3c3c3; + text-decoration: none; + font-weight: bold; + background: transparent; + } +.leaflet-container a.leaflet-popup-close-button:hover { + color: #999; + } +.leaflet-popup-scrolled { + overflow: auto; + border-bottom: 1px solid #ddd; + border-top: 1px solid #ddd; + } + +.leaflet-oldie .leaflet-popup-content-wrapper { + zoom: 1; + } +.leaflet-oldie .leaflet-popup-tip { + width: 24px; + margin: 0 auto; + + -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; + filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); + } +.leaflet-oldie .leaflet-popup-tip-container { + margin-top: -1px; + } + +.leaflet-oldie .leaflet-control-zoom, +.leaflet-oldie .leaflet-control-layers, +.leaflet-oldie .leaflet-popup-content-wrapper, +.leaflet-oldie .leaflet-popup-tip { + border: 1px solid #999; + } + + +/* div icon */ + +.leaflet-div-icon { + background: #fff; + border: 1px solid #666; + } + + +/* Tooltip */ +/* Base styles for the element that has a tooltip */ +.leaflet-tooltip { + position: absolute; + padding: 6px; + background-color: #fff; + border: 1px solid #fff; + border-radius: 3px; + color: #222; + white-space: nowrap; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + pointer-events: none; + box-shadow: 0 1px 3px rgba(0,0,0,0.4); + } +.leaflet-tooltip.leaflet-clickable { + cursor: pointer; + pointer-events: auto; + } +.leaflet-tooltip-top:before, +.leaflet-tooltip-bottom:before, +.leaflet-tooltip-left:before, +.leaflet-tooltip-right:before { + position: absolute; + pointer-events: none; + border: 6px solid transparent; + background: transparent; + content: ""; + } + +/* Directions */ + +.leaflet-tooltip-bottom { + margin-top: 6px; +} +.leaflet-tooltip-top { + margin-top: -6px; +} +.leaflet-tooltip-bottom:before, +.leaflet-tooltip-top:before { + left: 50%; + margin-left: -6px; + } +.leaflet-tooltip-top:before { + bottom: 0; + margin-bottom: -12px; + border-top-color: #fff; + } +.leaflet-tooltip-bottom:before { + top: 0; + margin-top: -12px; + margin-left: -6px; + border-bottom-color: #fff; + } +.leaflet-tooltip-left { + margin-left: -6px; +} +.leaflet-tooltip-right { + margin-left: 6px; +} +.leaflet-tooltip-left:before, +.leaflet-tooltip-right:before { + top: 50%; + margin-top: -6px; + } +.leaflet-tooltip-left:before { + right: 0; + margin-right: -12px; + border-left-color: #fff; + } +.leaflet-tooltip-right:before { + left: 0; + margin-left: -12px; + border-right-color: #fff; + } diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index 9f5e58d2b..9802f11e2 100644 --- a/searx/templates/oscar/infobox.html +++ b/searx/templates/oscar/infobox.html @@ -6,7 +6,7 @@
{% if infobox.img_src %}{{ infobox.infobox }}{% endif %} - {% if infobox.content %}

{{ infobox.content }}

{% endif %} + {% if infobox.content %}

{{ infobox.content | safe }}

{% endif %} {% if infobox.attributes -%}
" + row + ""; + switch(row) { + case "phone": + case "fax": + newHtml += "" + element.tags[row] + ""; + break; + case "email": + newHtml += "" + element.tags[row] + ""; + break; + case "website": + case "url": + newHtml += "" + element.tags[row] + ""; + break; + case "wikidata": + newHtml += "" + element.tags[row] + ""; + break; + case "wikipedia": + if(element.tags[row].indexOf(":") != -1) { + newHtml += "" + element.tags[row] + ""; + break; + } + /* jshint ignore:start */ + default: + /* jshint ignore:end */ + newHtml += element.tags[row]; + break; + } + newHtml += "
" + row + ""; - switch(row) { - case "phone": - case "fax": - newHtml += "" + element.tags[row] + ""; - break; - case "email": - newHtml += "" + element.tags[row] + ""; - break; - case "website": - case "url": - newHtml += "" + element.tags[row] + ""; - break; - case "wikidata": - newHtml += "" + element.tags[row] + ""; - break; - case "wikipedia": - if(element.tags[row].indexOf(":") != -1) { - newHtml += "" + element.tags[row] + ""; - break; - } - /* jshint ignore:start */ - default: - /* jshint ignore:end */ - newHtml += element.tags[row]; - break; - } - newHtml += "
" + row + ""; + switch(row) { + case "phone": + case "fax": + newHtml += "" + element.tags[row] + ""; + break; + case "email": + newHtml += "" + element.tags[row] + ""; + break; + case "website": + case "url": + newHtml += "" + element.tags[row] + ""; + break; + case "wikidata": + newHtml += "" + element.tags[row] + ""; + break; + case "wikipedia": + if(element.tags[row].indexOf(":") != -1) { + newHtml += "" + element.tags[row] + ""; + break; + } + /* jshint ignore:start */ + default: + /* jshint ignore:end */ + newHtml += element.tags[row]; + break; + } + newHtml += "
diff --git a/searx/templates/oscar/languages.html b/searx/templates/oscar/languages.html index c52cbd14a..5aff9f918 100644 --- a/searx/templates/oscar/languages.html +++ b/searx/templates/oscar/languages.html @@ -1,12 +1,8 @@ -{% if preferences -%} - -{%- endif -%} - - {%- for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) -%} - - {%- endfor -%} - \ No newline at end of file + diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html index b64d72ddf..1a484dd4b 100644 --- a/searx/templates/oscar/preferences.html +++ b/searx/templates/oscar/preferences.html @@ -41,7 +41,7 @@ {% set language_label = _('Search language') %} {% set language_info = _('What language do you prefer for search?') %} {{ preferences_item_header(language_info, language_label, rtl) }} - {% include 'oscar/languages.html' %} + {% include 'oscar/languages.html' %} {{ preferences_item_footer(language_info, language_label, rtl) }} {% set locale_label = _('Interface language') %} @@ -156,26 +156,26 @@
-
- +
+ {% if not rtl %} - - - - - - - - + + + + + + + + {% else %} - - - - - - - - + + + + + + + + {% endif %} {% for search_engine in engines_by_category[categ] %} @@ -186,19 +186,19 @@ {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }} - - - - - - - {% else %} - - - - - - + + + + + + + {% else %} + + + + + + {% endif %} {% endfor %} -
{{ _("Allow") }}{{ _("Engine name") }}{{ _("Shortcut") }}{{ _("Selected language") }}{{ _("SafeSearch") }}{{ _("Time range") }}{{ _("Avg. time") }}{{ _("Max time") }}{{ _("Allow") }}{{ _("Engine name") }}{{ _("Shortcut") }}{{ _("Selected language") }}{{ _("SafeSearch") }}{{ _("Time range") }}{{ _("Avg. time") }}{{ _("Max time") }}{{ _("Max time") }}{{ _("Avg. time") }}{{ _("Time range") }}{{ _("SafeSearch") }}{{ _("Selected language") }}{{ _("Shortcut") }}{{ _("Engine name") }}{{ _("Allow") }}{{ _("Max time") }}{{ _("Avg. time") }}{{ _("Time range") }}{{ _("SafeSearch") }}{{ _("Selected language") }}{{ _("Shortcut") }}{{ _("Engine name") }}{{ _("Allow") }}
{{ search_engine.name }}{{ shortcuts[search_engine.name] }}{{ support_toggle(stats[search_engine.name].supports_selected_language) }}{{ support_toggle(search_engine.safesearch==True) }}{{ support_toggle(search_engine.time_range_support==True) }}{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}{{ search_engine.timeout }}{{ search_engine.timeout }}{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}{{ support_toggle(search_engine.time_range_support==True) }}{{ support_toggle(search_engine.safesearch==True) }}{{ support_toggle(stats[search_engine.name].supports_selected_language) }}{{ shortcuts[search_engine.name] }}{{ shortcuts[search_engine.name] }}{{ support_toggle(stats[search_engine.name].supports_selected_language) }}{{ support_toggle(search_engine.safesearch==True) }}{{ support_toggle(search_engine.time_range_support==True) }}{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}{{ search_engine.timeout }}{{ search_engine.timeout }}{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}{{ support_toggle(search_engine.time_range_support==True) }}{{ support_toggle(search_engine.safesearch==True) }}{{ support_toggle(stats[search_engine.name].supports_selected_language) }}{{ shortcuts[search_engine.name] }} {{ search_engine.name }} {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }} @@ -207,7 +207,7 @@
+ diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html index ba74d0333..a1c18a6b7 100644 --- a/searx/templates/oscar/result_templates/code.html +++ b/searx/templates/oscar/result_templates/code.html @@ -1,18 +1,18 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} - -{{ result_header(result, favicons) }} -{{ result_sub_header(result) }} - -{% if result.content %}

{{ result.content|safe }}

{% endif %} - -{% if result.repository %}

{{ icon('file') }} {{ result.repository }}

{% endif %} - -
-{{ result.codelines|code_highlighter(result.code_language)|safe }} -
- -{% if rtl %} -{{ result_footer_rtl(result) }} -{% else %} -{{ result_footer(result) }} -{% endif %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} + +{{ result_header(result, favicons) }} +{{ result_sub_header(result) }} + +{% if result.content %}

{{ result.content|safe }}

{% endif %} + +{% if result.repository %}

{{ icon('file') }} {{ result.repository }}

{% endif %} + +
+{{ result.codelines|code_highlighter(result.code_language)|safe }} +
+ +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} +{{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html index 8985a9f4e..d0a3b7b83 100644 --- a/searx/templates/oscar/result_templates/images.html +++ b/searx/templates/oscar/result_templates/images.html @@ -22,7 +22,7 @@ {{ result.engine }}{{- "" -}}

{{ result.pretty_url }}

{{- "" -}}
{{- "" -}} -
{{- "" -}} +
{{- "" -}}
{{- "" -}} {{ _('Get image') }}{{- "" -}}
{{- "" -}} diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html index 822c7cdea..712375d7f 100644 --- a/searx/templates/oscar/result_templates/map.html +++ b/searx/templates/oscar/result_templates/map.html @@ -1,72 +1,72 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} - -{{ result_header(result, favicons) }} -{{ result_sub_header(result) }} - -{% if (result.latitude and result.longitude) or result.boundingbox %} - -{% endif %} - -{% if result.osm and (result.osm.type and result.osm.id) %} - -{% endif %} - -{# {% if (result.latitude and result.longitude) %} - -{% endif %} #} - -
- -{% if result.address %} -

- {% if result.address.name %} - {{ result.address.name }}
- {% endif %} - {% if result.address.road %} - - {% if result.address.house_number %}{{ result.address.house_number }}, {% endif %} - {{ result.address.road }} -
- {% endif %} - {% if result.address.locality %} - {{ result.address.locality }} - {% if result.address.postcode %}, {{ result.address.postcode }}{% endif %} -
- {% endif %} - {% if result.address.country %} - {{ result.address.country }} - {% endif %} -

-{% endif %} - -{% if result.osm and (result.osm.type and result.osm.id) %} -
-
Loading ...
- - - -
-{% endif %} - -{# {% if (result.latitude and result.longitude) %} -
- Longitude: {{ result.longitude }}
- Latitude: {{ result.latitude }} -
-{% endif %} #} - -{% if result.content %}

{{ result.content|safe }}

{% endif %} - -
- -{% if (result.latitude and result.longitude) or result.boundingbox %} -
-
-
-{% endif %} - -{% if rtl %} -{{ result_footer_rtl(result) }} -{% else %} -{{ result_footer(result) }} -{% endif %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} + +{{ result_header(result, favicons) }} +{{ result_sub_header(result) }} + +{% if (result.latitude and result.longitude) or result.boundingbox %} + +{% endif %} + +{% if result.osm and (result.osm.type and result.osm.id) %} + +{% endif %} + +{# {% if (result.latitude and result.longitude) %} + +{% endif %} #} + +
+ +{% if result.address %} +

+ {% if result.address.name %} + {{ result.address.name }}
+ {% endif %} + {% if result.address.road %} + + {% if result.address.house_number %}{{ result.address.house_number }}, {% endif %} + {{ result.address.road }} +
+ {% endif %} + {% if result.address.locality %} + {{ result.address.locality }} + {% if result.address.postcode %}, {{ result.address.postcode }}{% endif %} +
+ {% endif %} + {% if result.address.country %} + {{ result.address.country }} + {% endif %} +

+{% endif %} + +{% if result.osm and (result.osm.type and result.osm.id) %} +
+
Loading ...
+ + + +
+{% endif %} + +{# {% if (result.latitude and result.longitude) %} +
+ Longitude: {{ result.longitude }}
+ Latitude: {{ result.latitude }} +
+{% endif %} #} + +{% if result.content %}

{{ result.content|safe }}

{% endif %} + +
+ +{% if (result.latitude and result.longitude) or result.boundingbox %} +
+
+
+{% endif %} + +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} +{{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html index 36fb26240..3c1913d9d 100644 --- a/searx/templates/oscar/result_templates/videos.html +++ b/searx/templates/oscar/result_templates/videos.html @@ -1,27 +1,27 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} - -{{ result_header(result, favicons) }} -{{ result_sub_header(result) }} - -{% if result.embedded %} - -{% endif %} - -{% if result.embedded %} -
- {{ result.embedded|safe }} -
-{% endif %} - -
-
- {{ result.title|striptags }} {{ result.engine }} - {% if result.content %}

{{ result.content|safe }}

{% endif %} -
-
- -{% if rtl %} -{{ result_footer_rtl(result) }} -{% else %} -{{ result_footer(result) }} -{% endif %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} + +{{ result_header(result, favicons) }} +{{ result_sub_header(result) }} + +{% if result.embedded %} + +{% endif %} + +{% if result.embedded %} +
+ {{ result.embedded|safe }} +
+{% endif %} + +
+
+ {{ result.title|striptags }} {{ result.engine }} + {% if result.content %}

{{ result.content|safe }}

{% endif %} +
+
+ +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} +{{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html index a33d5b895..43e3e26d9 100644 --- a/searx/templates/oscar/results.html +++ b/searx/templates/oscar/results.html @@ -15,7 +15,68 @@ {% include 'oscar/search.html' %}
-
+ + +

{{ _('Search results') }}

{% if corrections -%} @@ -91,66 +152,5 @@ {% endif %} {% endif %}
- -
{% endblock %} diff --git a/searx/templates/oscar/search.html b/searx/templates/oscar/search.html index 7f41b233b..cad9eca89 100644 --- a/searx/templates/oscar/search.html +++ b/searx/templates/oscar/search.html @@ -3,7 +3,7 @@
- + diff --git a/searx/templates/oscar/search_full.html b/searx/templates/oscar/search_full.html index fd8a9a393..656463178 100644 --- a/searx/templates/oscar/search_full.html +++ b/searx/templates/oscar/search_full.html @@ -1,18 +1,18 @@ -{% from 'oscar/macros.html' import icon %} - -