on master help sign in
Merge branch 'master' into fix/manage.sh
commit4bae1a9eabd33ee095002c0392d26c45e8319159 authorMarkus Heiser <markus.heiser@darmarIT.de> dateWed 29 Apr 2020, 12:55 (6 years ago) parentceceee57342806
274 files changed+41810−40576
.dockerignore+8 .gitignore+4−1 .travis.yml+16−15 AUTHORS.rst+24 CHANGELOG.rst+38 Dockerfile+10−2 Makefile+184−11 README.rst+7−7 dockerfiles/uwsgi.ini+4 docs/_themes/searx/static/searx.css+130 docs/_themes/searx/theme.conf+6 docs/admin/api.rst+96 docs/admin/arch_public.dot+33 docs/admin/architecture.rst+24 docs/admin/buildhosts.rst+103 docs/admin/engines.rst+71 docs/admin/filtron.rst+148 docs/admin/index.rst+16 docs/admin/installation.rst+349 docs/admin/morty.rst+26 docs/admin/plugins.rst+39 docs/admin/settings.rst+181 docs/blog/admin.rst+43 docs/blog/index.rst+11 docs/blog/intro-offline.rst+77 docs/blog/private-engines.rst+63 docs/blog/python3.rst+68 docs/blog/searx-admin-engines.png docs/blog/searxpy3.png docs/conf.py+114 docs/dev/contribution_guide.rst+180 docs/dev/csv_table.txt+6 docs/dev/engine_overview.rst+267 docs/dev/hello.dot+3 docs/dev/index.rst+15 docs/dev/makefile.rst+221 docs/dev/plugins.rst+54 docs/dev/quickstart.rst+132 docs/dev/reST.rst+1428 docs/dev/search_api.rst+120 docs/dev/svg_image.svg+10 docs/dev/translation.rst+71 docs/index.rst+34 docs/static/img/searx_logo_small.png docs/user/index.rst+9 docs/user/own-instance.rst+77 docs/user/public_instances.rst+3 docs/user/search_syntax.rst+42 manage.sh+14−86 requirements-dev.txt+7 requirements.txt+9−9 searx/__init__.py+1 searx/autocomplete.py+9 searx/brand.py+5 searx/data/engines_languages.json+28332−27487 searx/data/useragents.json+5−8 searx/engines/__init__.py+7−2 searx/engines/bing.py+16−12 searx/engines/bing_images.py+2−19 searx/engines/bing_news.py+3−1 searx/engines/bing_videos.py+5−1 searx/engines/dummy-offline.py+12 searx/engines/etools.py+54 searx/engines/faroo.py−96 searx/engines/flickr_noapi.py+17−9 searx/engines/genius.py+1 searx/engines/gigablast.py+28−13 searx/engines/google_news.py+1−1 searx/engines/ina.py+6−3 searx/engines/microsoft_academic.py+2 searx/engines/openstreetmap.py+1−1 searx/engines/qwant.py+1 searx/engines/scanr_structures.py+1−1 searx/engines/spotify.py+14 searx/engines/startpage.py+5−2 searx/engines/wikipedia.py+7−2 searx/languages.py+12−4 searx/preferences.py+196−57 searx/query.py+3−1 searx/results.py+2−2 searx/search.py+9−13 searx/settings.yml+109−22 searx/settings_robot.yml+2−6 searx/static/plugins/js/infinite_scroll.js+33−11 searx/static/plugins/js/vim_hotkeys.js+10−2 searx/static/themes/oscar/.gitignore+1−1 searx/static/themes/oscar/gruntfile.js+1−3 searx/static/themes/oscar/js/searx.js+3 searx/static/themes/oscar/js/searx.min.js+2−2 searx/static/themes/oscar/js/searx_src/autocompleter.js+3 searx/static/themes/simple/.gitignore+1 searx/static/themes/simple/gruntfile.js+3−3 searx/templates/__common__/about.html+86−52 searx/templates/__common__/opensearch_response_rss.xml+24 searx/templates/courgette/github_ribbon.html+1−1 searx/templates/oscar/base.html+4−4 searx/templates/oscar/infobox.html+1−1 searx/templates/oscar/preferences.html+6 searx/templates/oscar/results.html+62−62 searx/templates/oscar/search.html+1 searx/templates/oscar/search_full.html+1 searx/templates/simple/base.html+3−3 searx/testing.py+18−11 searx/translations/ar/LC_MESSAGES/messages.mo searx/translations/ar/LC_MESSAGES/messages.po+68−82 searx/translations/bg/LC_MESSAGES/messages.mo searx/translations/bg/LC_MESSAGES/messages.po+68−82 searx/translations/bo/LC_MESSAGES/messages.mo searx/translations/bo/LC_MESSAGES/messages.po+998 searx/translations/ca/LC_MESSAGES/messages.mo searx/translations/ca/LC_MESSAGES/messages.po+69−83 searx/translations/cs/LC_MESSAGES/messages.mo searx/translations/cs/LC_MESSAGES/messages.po+68−82 searx/translations/cy/LC_MESSAGES/messages.mo searx/translations/cy/LC_MESSAGES/messages.po+68−83 searx/translations/da/LC_MESSAGES/messages.mo searx/translations/da/LC_MESSAGES/messages.po+68−83 searx/translations/de/LC_MESSAGES/messages.mo searx/translations/de/LC_MESSAGES/messages.po+73−86 searx/translations/el_GR/LC_MESSAGES/messages.mo searx/translations/el_GR/LC_MESSAGES/messages.po+67−82 searx/translations/en/LC_MESSAGES/messages.mo searx/translations/eo/LC_MESSAGES/messages.mo searx/translations/eo/LC_MESSAGES/messages.po+68−83 searx/translations/es/LC_MESSAGES/messages.mo searx/translations/es/LC_MESSAGES/messages.po+69−84 searx/translations/et/LC_MESSAGES/messages.mo searx/translations/et/LC_MESSAGES/messages.po+998 searx/translations/eu/LC_MESSAGES/messages.mo searx/translations/eu/LC_MESSAGES/messages.po+74−89 searx/translations/fa_IR/LC_MESSAGES/messages.mo searx/translations/fa_IR/LC_MESSAGES/messages.po+71−84 searx/translations/fi/LC_MESSAGES/messages.mo searx/translations/fi/LC_MESSAGES/messages.po+67−82 searx/translations/fil/LC_MESSAGES/messages.mo searx/translations/fil/LC_MESSAGES/messages.po+68−83 searx/translations/fr/LC_MESSAGES/messages.mo searx/translations/fr/LC_MESSAGES/messages.po+69−83 searx/translations/gl/LC_MESSAGES/messages.mo searx/translations/gl/LC_MESSAGES/messages.po+68−83 searx/translations/he/LC_MESSAGES/messages.mo searx/translations/he/LC_MESSAGES/messages.po+85−100 searx/translations/hr/LC_MESSAGES/messages.mo searx/translations/hr/LC_MESSAGES/messages.po+68−83 searx/translations/hu/LC_MESSAGES/messages.mo searx/translations/hu/LC_MESSAGES/messages.po+67−82 searx/translations/ia/LC_MESSAGES/messages.mo searx/translations/ia/LC_MESSAGES/messages.po+19−19 searx/translations/it/LC_MESSAGES/messages.mo searx/translations/it/LC_MESSAGES/messages.po+82−97 searx/translations/ja/LC_MESSAGES/messages.mo searx/translations/ja/LC_MESSAGES/messages.po+70−84 searx/translations/lt/LC_MESSAGES/messages.mo searx/translations/lt/LC_MESSAGES/messages.po+998 searx/translations/nl/LC_MESSAGES/messages.mo searx/translations/nl/LC_MESSAGES/messages.po+67−82 searx/translations/nl_BE/LC_MESSAGES/messages.mo searx/translations/nl_BE/LC_MESSAGES/messages.po+68−83 searx/translations/oc/LC_MESSAGES/messages.mo searx/translations/oc/LC_MESSAGES/messages.po+999 searx/translations/pl/LC_MESSAGES/messages.mo searx/translations/pt/LC_MESSAGES/messages.mo searx/translations/pt/LC_MESSAGES/messages.po+69−84 searx/translations/pt_BR/LC_MESSAGES/messages.mo searx/translations/pt_BR/LC_MESSAGES/messages.po+70−85 searx/translations/ro/LC_MESSAGES/messages.mo searx/translations/ro/LC_MESSAGES/messages.po+70−83 searx/translations/ru/LC_MESSAGES/messages.mo searx/translations/ru/LC_MESSAGES/messages.po+68−83 searx/translations/sk/LC_MESSAGES/messages.mo searx/translations/sk/LC_MESSAGES/messages.po+69−84 searx/translations/sl/LC_MESSAGES/messages.mo searx/translations/sl/LC_MESSAGES/messages.po+67−82 searx/translations/sr/LC_MESSAGES/messages.mo searx/translations/sr/LC_MESSAGES/messages.po+70−84 searx/translations/sv/LC_MESSAGES/messages.mo searx/translations/sv/LC_MESSAGES/messages.po+72−87 searx/translations/ta/LC_MESSAGES/messages.mo searx/translations/ta/LC_MESSAGES/messages.po+1003 searx/translations/te/LC_MESSAGES/messages.mo searx/translations/te/LC_MESSAGES/messages.po+67−82 searx/translations/tr/LC_MESSAGES/messages.mo searx/translations/tr/LC_MESSAGES/messages.po+67−82 searx/translations/uk/LC_MESSAGES/messages.mo searx/translations/uk/LC_MESSAGES/messages.po+69−83 searx/translations/vi/LC_MESSAGES/messages.mo searx/translations/vi/LC_MESSAGES/messages.po+68−83 searx/translations/zh_CN/LC_MESSAGES/messages.mo searx/translations/zh_CN/LC_MESSAGES/messages.po+73−86 searx/translations/zh_Hant_TW/LC_MESSAGES/messages.mo searx/translations/zh_TW/LC_MESSAGES/messages.mo searx/translations/zh_TW/LC_MESSAGES/messages.po+71−85 searx/version.py+1−1 searx/webapp.py+149−53 setup.py+6−1 tests/unit/engines/__init__.py tests/unit/engines/pubmed.py−37 tests/unit/engines/seedpeer_fixture.html−110 tests/unit/engines/test_acgsou.py−78 tests/unit/engines/test_archlinux.py−111 tests/unit/engines/test_arxiv.py−58 tests/unit/engines/test_base.py−91 tests/unit/engines/test_bing.py−178 tests/unit/engines/test_bing_images.py−132 tests/unit/engines/test_bing_news.py−147 tests/unit/engines/test_bing_videos.py−72 tests/unit/engines/test_btdigg.py−112 tests/unit/engines/test_currency_convert.py−56 tests/unit/engines/test_dailymotion.py−112 tests/unit/engines/test_deezer.py−57 tests/unit/engines/test_deviantart.py−24 tests/unit/engines/test_digbt.py−61 tests/unit/engines/test_digg.py−16 tests/unit/engines/test_doku.py−79 tests/unit/engines/test_duckduckgo.py−106 tests/unit/engines/test_duckduckgo_definitions.py−255 tests/unit/engines/test_duckduckgo_images.py−75 tests/unit/engines/test_duden.py−47 tests/unit/engines/test_dummy.py−26 tests/unit/engines/test_faroo.py−113 tests/unit/engines/test_fdroid.py−60 tests/unit/engines/test_flickr.py−142 tests/unit/engines/test_flickr_noapi.py−357 tests/unit/engines/test_framalibre.py−103 tests/unit/engines/test_frinkiac.py−50 tests/unit/engines/test_genius.py−231 tests/unit/engines/test_gigablast.py−119 tests/unit/engines/test_github.py−61 tests/unit/engines/test_google.py−194 tests/unit/engines/test_google_images.py−27 tests/unit/engines/test_google_news.py−102 tests/unit/engines/test_google_videos.py−79 tests/unit/engines/test_ina.py−64 tests/unit/engines/test_kickass.py−397 tests/unit/engines/test_mediawiki.py−130 tests/unit/engines/test_mixcloud.py−67 tests/unit/engines/test_nyaa.py−124 tests/unit/engines/test_openstreetmap.py−199 tests/unit/engines/test_pdbe.py−109 tests/unit/engines/test_photon.py−166 tests/unit/engines/test_piratebay.py−166 tests/unit/engines/test_qwant.py−339 tests/unit/engines/test_reddit.py−71 tests/unit/engines/test_scanr_structures.py−175 tests/unit/engines/test_searchcode_code.py−75 tests/unit/engines/test_searchcode_doc.py−70 tests/unit/engines/test_seedpeer.py−66 tests/unit/engines/test_soundcloud.py−192 tests/unit/engines/test_spotify.py−124 tests/unit/engines/test_stackoverflow.py−106 tests/unit/engines/test_startpage.py−67 tests/unit/engines/test_tokyotoshokan.py−110 tests/unit/engines/test_torrentz.py−87 tests/unit/engines/test_twitter.py−502 tests/unit/engines/test_unsplash.py−38 tests/unit/engines/test_vimeo.py−36 tests/unit/engines/test_wikidata.py−514 tests/unit/engines/test_wikipedia.py−263 tests/unit/engines/test_wolframalpha_api.py−166 tests/unit/engines/test_wolframalpha_noapi.py−224 tests/unit/engines/test_www1x.py−14 tests/unit/engines/test_yacy.py−96 tests/unit/engines/test_yahoo.py−190 tests/unit/engines/test_yahoo_news.py−150 tests/unit/engines/test_youtube_api.py−111 tests/unit/engines/test_youtube_noapi.py−124 tests/unit/engines/unsplash_fixture.json−241 tests/unit/test_search.py+71−19 tests/unit/test_webapp.py+3−3 utils/brand.env+5 utils/fetch_firefox_version.py+1−1 utils/fetch_languages.py+13−10 utils/makefile.python+23−50 utils/makefile.sphinx+216
.dockerignore+8
@@ -4,6 +4,9 @@
44*/*/*/*~
55*/*/*/*/*~
66
7+#
8+local/
9+
710# Git
811.git
912.gitignore
@@ -36,6 +39,11 @@ robot_report.html
3639test_basic/
3740setup.cfg
3841
42+# node_modules
3943node_modules/
44+*/node_modules/
45+*/*/node_modules/
46+*/*/*/node_modules/
47+*/*/*/*/node_modules/
4048
4149.tx/
.gitignore+4−1
@@ -15,9 +15,12 @@ setup.cfg
1515*/*.pyc
1616*~
1717
18−node_modules/
18+/node_modules
1919
2020.tx/
2121
22+build/
23+dist/
2224local/
25+gh-pages/
2326searx.egg-info/
.travis.yml+16−15
@@ -1,26 +1,24 @@
1+os: linux
2+dist: bionic
13language: python
2−sudo: false
34cache:
4− - pip
5− - npm
65 - directories:
76 - $HOME/.cache/pip
8−
97addons:
108 firefox: "latest"
119
1210install:
13− - ./manage.sh install_geckodriver ~/drivers
14− - export PATH=~/drivers:$PATH
15− - ./manage.sh npm_packages
16− - ./manage.sh update_dev_packages
17− - pip install codecov
11+ - env
12+ - which python; python --version
13+ - make V=1 install
14+ - make V=1 gecko.driver
15+ - make V=1 node.env
16+ - make V=1 travis.codecov
1817script:
19− - ./manage.sh styles
20− - ./manage.sh grunt_build
21− - ./manage.sh tests
18+ - make V=1 themes
19+ - make V=1 test
2220after_success:
23− - ./manage.sh py_test_coverage
21+ - make V=1 test.coverage
2422 - codecov
2523
2624stages:
@@ -31,10 +29,13 @@ stages:
3129jobs:
3230 include:
3331 - python: "2.7"
32+ env: PY=2
3433 - python: "3.5"
3534 - python: "3.6"
35+ - python: "3.7"
36+ - python: "3.8"
3637 - stage: docker
37− python: "3.6"
38+ python: "3.8"
3839 git:
3940 depth: false
4041 services:
@@ -44,7 +45,7 @@ jobs:
4445 install: true
4546 script:
4647 - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
47− - ./manage.sh docker_build push
48+ - make -e GIT_URL=$(git remote get-url origin) docker.push
4849 after_success: true
4950
5051notifications:
AUTHORS.rst+24
@@ -100,3 +100,27 @@ generally made searx better:
100100- @ZEROF
101101- Ivan Skytte Jørgensen @isj-privacore
102102- @miicha
103+- Étienne Deparis @milouse
104+- @pelag0s
105+- Denis Wernert @d-tux
106+- Robin Hallabro-Kokko @hallabro
107+- Jonas Zohren @jfowl
108+- Elias Ojala @theel0ja
109+- @brunob
110+- Nick Espig @nachtalb
111+- Rachmadani Haryono @rachmadaniHaryono
112+- Frank de Lange @yetangitu
113+- Émilien Devos @unifox
114+- Nicolas Gelot @nfk
115+- @volth
116+- Mathieu Brunot @madmath03
117+- @lorddavidiii
118+- @x250
119+- Robby O'Connor @robbyoconnor
120+- Finn @0xhtml
121+- @tmikaeld
122+- @hobbestigrou
123+- Vipul @finn0
124+- @CaffeinatedTech
125+- Robin Schneider @ypid
126+- @splintah
CHANGELOG.rst+38
@@ -1,3 +1,41 @@
1+0.16.0 2020.01.30
2+=================
3+
4+- New engines
5+
6+ - Splash
7+ - Apkmirror
8+ - NPM search
9+ - Invidious
10+ - Seedpeer
11+- New languages
12+
13+ - Estonian
14+ - Interlingua
15+ - Lithuanian
16+ - Tibetian
17+ - Occitan
18+ - Tamil
19+- Engine fixes (wolframalpha, google scholar, youtube, google images, seznam, google, soundcloud, google cloud, duden, btdigg, google play, bing images, flickr noapi, wikidata, dailymotion, google videos, arxiv, dictzone, fdroid, etymonline, bing, duckduckgo, startpage, voat, 1x, deviantart, digg, gigablast, mojeek, duckduckgo definitions, spotify, libgen, qwant, openstreetmap, wikipedia, ina, microsoft academic, scanr structures)
20+- Dependency updates
21+- Speed optimizations
22+- Initial support for offline engines
23+- Image format display
24+- Inline js scripts removed
25+- Infinite scroll plugin fix
26+- Simple theme bugfixes
27+- Docker image updates
28+- Bang expression fixes
29+- Result merging fixes
30+- New environment variable added: SEARX_BIND_ADDRESS
31+
32+
33+News
34+~~~~
35+
36+- @return42 joined the maintainer team
37+- This is the last release with Python2 support
38+
1390.15.0 2019.01.06
240=================
341
Dockerfile+10−2
@@ -4,6 +4,7 @@ EXPOSE 8080
44VOLUME /etc/searx
55VOLUME /var/log/uwsgi
66
7+ARG GIT_URL=unknown
78ARG VERSION_GITCOMMIT=unknown
89ARG SEARX_GIT_VERSION=unknown
910
@@ -66,7 +67,7 @@ RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
6667
6768# Keep this argument at the end since it change each time
6869ARG LABEL_DATE=
69−LABEL maintainer="searx <https://github.com/asciimoo/searx>" \
70+LABEL maintainer="searx <${GIT_URL}>" \
7071 description="A privacy-respecting, hackable metasearch engine." \
7172 version="${SEARX_GIT_VERSION}" \
7273 org.label-schema.schema-version="1.0" \
@@ -76,4 +77,11 @@ LABEL maintainer="searx <https://github.com/asciimoo/searx>" \
7677 org.label-schema.vcs-ref=${LABEL_VCS_REF} \
7778 org.label-schema.vcs-url=${LABEL_VCS_URL} \
7879 org.label-schema.build-date="${LABEL_DATE}" \
79− org.label-schema.usage="https://github.com/searx/searx-docker"
80+ org.label-schema.usage="https://github.com/searx/searx-docker" \
81+ org.opencontainers.image.title="searx" \
82+ org.opencontainers.image.version="${SEARX_GIT_VERSION}" \
83+ org.opencontainers.image.url="${LABEL_VCS_URL}" \
84+ org.opencontainers.image.revision=${LABEL_VCS_REF} \
85+ org.opencontainers.image.source=${LABEL_VCS_URL} \
86+ org.opencontainers.image.created="${LABEL_DATE}" \
87+ org.opencontainers.image.documentation="https://github.com/searx/searx-docker"
Makefile+184−11
@@ -1,36 +1,54 @@
11# -*- coding: utf-8; mode: makefile-gmake -*-
22
3+export GIT_URL=https://github.com/asciimoo/searx
4+export SEARX_URL=https://searx.me
5+export DOCS_URL=https://asciimoo.github.io/searx
6+
37PYOBJECTS = searx
8+DOC = docs
49PY_SETUP_EXTRAS ?= \[test\]
510
11+PYDIST=./dist/py
12+PYBUILD=./build/py
13+
614include utils/makefile.include
715include utils/makefile.python
16+include utils/makefile.sphinx
817
918all: clean install
1019
1120PHONY += help
1221help:
1322 @echo ' test - run developer tests'
23+ @echo ' docs - build documentation'
24+ @echo ' docs-live - autobuild HTML documentation while editing'
1425 @echo ' run - run developer instance'
1526 @echo ' install - developer install (./local)'
1627 @echo ' uninstall - uninstall (./local)'
28+ @echo ' gh-pages - build docs & deploy on gh-pages branch'
29+ @echo ' clean - drop builds and environments'
30+ @echo ' project - re-build generic files of the searx project'
31+ @echo ' buildenv - re-build environment files (aka brand)'
32+ @echo ' themes - re-build build the source of the themes'
33+ @echo ' docker - build Docker image'
34+ @echo ' node.env - download & install npm dependencies locally'
1735 @echo ''
1836 @$(MAKE) -s -f utils/makefile.include make-help
1937 @echo ''
2038 @$(MAKE) -s -f utils/makefile.python python-help
2139
2240PHONY += install
23−install: pyenvinstall
41+install: buildenv pyenvinstall
2442
2543PHONY += uninstall
2644uninstall: pyenvuninstall
2745
2846PHONY += clean
29−clean: pyclean
47+clean: pyclean node.clean test.clean
3048 $(call cmd,common_clean)
3149
3250PHONY += run
33−run: pyenvinstall
51+run: buildenv pyenvinstall
3452 $(Q) ( \
3553 sed -i -e "s/debug : False/debug : True/g" ./searx/settings.yml ; \
3654 sleep 2 ; \
@@ -40,23 +58,178 @@ run: pyenvinstall
4058 ) &
4159 $(PY_ENV)/bin/python ./searx/webapp.py
4260
61+# docs
62+# ----
63+
64+PHONY += docs
65+docs: buildenv pyenvinstall sphinx-doc
66+ $(call cmd,sphinx,html,docs,docs)
67+
68+PHONY += docs-live
69+docs-live: buildenv pyenvinstall sphinx-live
70+ $(call cmd,sphinx_autobuild,html,docs,docs)
71+
72+$(GH_PAGES)::
73+ @echo "doc available at --> $(DOCS_URL)"
74+
75+# update project files
76+# --------------------
77+
78+PHONY += project engines.languages useragents.update buildenv
79+
80+project: buildenv useragents.update engines.languages
81+
82+engines.languages: pyenvinstall
83+ $(Q)echo "fetch languages .."
84+ $(Q)$(PY_ENV_ACT); python utils/fetch_languages.py
85+ $(Q)echo "update searx/data/engines_languages.json"
86+ $(Q)mv engines_languages.json searx/data/engines_languages.json
87+ $(Q)echo "update searx/languages.py"
88+ $(Q)mv languages.py searx/languages.py
89+
90+useragents.update: pyenvinstall
91+ $(Q)echo "Update searx/data/useragents.json with the most recent versions of Firefox."
92+ $(Q)$(PY_ENV_ACT); python utils/fetch_firefox_version.py
93+
94+buildenv:
95+ $(Q)echo "build searx/brand.py"
96+ $(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
97+ $(Q)echo "ISSUE_URL = 'https://github.com/asciimoo/searx/issues'" >> searx/brand.py
98+ $(Q)echo "SEARX_URL = '$(SEARX_URL)'" >> searx/brand.py
99+ $(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
100+ $(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
101+ $(Q)echo "build utils/brand.env"
102+ $(Q)echo "export GIT_URL='$(GIT_URL)'" > utils/brand.env
103+ $(Q)echo "export ISSUE_URL='https://github.com/asciimoo/searx/issues'" >> utils/brand.env
104+ $(Q)echo "export SEARX_URL='$(SEARX_URL)'" >> utils/brand.env
105+ $(Q)echo "export DOCS_URL='$(DOCS_URL)'" >> utils/brand.env
106+ $(Q)echo "export PUBLIC_INSTANCES='https://searx.space'" >> utils/brand.env
107+
108+
109+# node / npm
110+# ----------
111+
112+node.env: buildenv
113+ $(Q)./manage.sh npm_packages
114+
115+node.clean:
116+ $(Q)echo "CLEAN locally installed npm dependencies"
117+ $(Q)rm -rf \
118+ ./node_modules \
119+ ./package-lock.json \
120+ ./searx/static/themes/oscar/package-lock.json \
121+ ./searx/static/themes/oscar/node_modules \
122+ ./searx/static/themes/simple/package-lock.json \
123+ ./searx/static/themes/simple/node_modules
124+
125+# build themes
126+# ------------
127+
128+PHONY += themes.bootstrap themes themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
129+themes: buildenv themes.bootstrap themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
130+
131+quiet_cmd_lessc = LESSC $3
132+ cmd_lessc = PATH="$$(npm bin):$$PATH" \
133+ lessc --clean-css="--s1 --advanced --compatibility=ie9" "searx/static/$2" "searx/static/$3"
134+
135+quiet_cmd_grunt = GRUNT $2
136+ cmd_grunt = PATH="$$(npm bin):$$PATH" \
137+ grunt --gruntfile "$2"
138+
139+themes.oscar:
140+ $(Q)echo '[!] build oscar theme'
141+ $(call cmd,grunt,searx/static/themes/oscar/gruntfile.js)
142+
143+themes.simple:
144+ $(Q)echo '[!] build simple theme'
145+ $(call cmd,grunt,searx/static/themes/simple/gruntfile.js)
146+
147+themes.legacy:
148+ $(Q)echo '[!] build legacy theme'
149+ $(call cmd,lessc,themes/legacy/less/style-rtl.less,themes/legacy/css/style-rtl.css)
150+ $(call cmd,lessc,themes/legacy/less/style.less,themes/legacy/css/style.css)
151+
152+themes.courgette:
153+ $(Q)echo '[!] build courgette theme'
154+ $(call cmd,lessc,themes/courgette/less/style.less,themes/courgette/css/style.css)
155+ $(call cmd,lessc,themes/courgette/less/style-rtl.less,themes/courgette/css/style-rtl.css)
156+
157+themes.pixart:
158+ $(Q)echo '[!] build pixart theme'
159+ $(call cmd,lessc,themes/pix-art/less/style.less,themes/pix-art/css/style.css)
160+
161+themes.bootstrap:
162+ $(call cmd,lessc,less/bootstrap/bootstrap.less,css/bootstrap.min.css)
163+
164+
165+# docker
166+# ------
167+
168+PHONY += docker
169+docker: buildenv
170+ $(Q)./manage.sh docker_build
171+
172+docker.push: buildenv
173+ $(Q)./manage.sh docker_build push
174+
175+# gecko
176+# -----
177+
178+PHONY += gecko.driver
179+gecko.driver:
180+ $(PY_ENV_ACT); ./manage.sh install_geckodriver
181+
43182# test
44183# ----
45184
46−PHONY += test test.pylint test.pep8 test.unit test.robot
185+PHONY += test test.pylint test.pep8 test.unit test.coverage test.robot
186+
187+test: buildenv test.pylint test.pep8 test.unit gecko.driver test.robot
47188
189+ifeq ($(PY),2)
190+test.pylint:
191+ @echo "LINT skip liniting py2"
192+else
48193# TODO: balance linting with pylint
49−test: test.pep8 test.unit test.robot
50− - make pylint
194+test.pylint: pyenvinstall
195+ $(call cmd,pylint,\
196+ searx/preferences.py \
197+ searx/testing.py \
198+ )
199+endif
200+
201+# ignored rules:
202+# E402 module level import not at top of file
203+# W503 line break before binary operator
51204
52205test.pep8: pyenvinstall
53− $(PY_ENV_ACT); ./manage.sh pep8_check
206+ @echo "TEST pep8"
207+ $(Q)$(PY_ENV_ACT); pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" searx tests
54208
55209test.unit: pyenvinstall
56− $(PY_ENV_ACT); ./manage.sh unit_tests
210+ @echo "TEST tests/unit"
211+ $(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
57212
58−test.robot: pyenvinstall
59− $(PY_ENV_ACT); ./manage.sh install_geckodriver
60− $(PY_ENV_ACT); ./manage.sh robot_tests
213+test.coverage: pyenvinstall
214+ @echo "TEST unit test coverage"
215+ $(Q)$(PY_ENV_ACT); \
216+ python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit \
217+ && coverage report \
218+ && coverage html \
219+
220+test.robot: pyenvinstall gecko.driver
221+ @echo "TEST robot"
222+ $(Q)$(PY_ENV_ACT); PYTHONPATH=. python searx/testing.py robot
223+
224+test.clean:
225+ @echo "CLEAN intermediate test stuff"
226+ $(Q)rm -rf geckodriver.log .coverage coverage/
227+
228+
229+# travis
230+# ------
231+
232+travis.codecov:
233+ $(Q)$(PY_ENV_BIN)/python -m pip install codecov
61234
62235.PHONY: $(PHONY)
README.rst+7−7
@@ -7,7 +7,7 @@ engine <https://en.wikipedia.org/wiki/Metasearch_engine>`__.
77Pronunciation: səːks
88
99List of `running
10−instances <https://github.com/asciimoo/searx/wiki/Searx-instances>`__.
10+instances <https://searx.space/>`__.
1111
1212See the `documentation <https://asciimoo.github.io/searx>`__ and the `wiki <https://github.com/asciimoo/searx/wiki>`__ for more information.
1313
@@ -18,18 +18,18 @@ Installation
1818~~~~~~~~~~~~
1919
2020With Docker
21−------
21+-----------
2222Go to the `searx-docker <https://github.com/searx/searx-docker>`__ project.
2323
2424Without Docker
25−------
26−For all the details, follow this `step by step installation <https://asciimoo.github.io/searx/dev/install/installation.html>`__.
25+--------------
26+For all of the details, follow this `step by step installation <https://asciimoo.github.io/searx/admin/installation.html>`__.
2727
2828Note: the documentation needs to be updated.
2929
30−If you are in hurry
31−------
32−- clone source:
30+If you are in a hurry
31+---------------------
32+- clone the source:
3333 ``git clone https://github.com/asciimoo/searx.git && cd searx``
3434- install dependencies: ``./manage.sh update_packages``
3535- edit your
dockerfiles/uwsgi.ini+4
@@ -31,3 +31,7 @@ touch-logrotate = /run/uwsgi-logrotate
3131unique-cron = 15 0 -1 -1 -1 { touch /run/uwsgi-logrotate }
3232log-backupname = /var/log/uwsgi/uwsgi.log.1
3333logto = /var/log/uwsgi/uwsgi.log
34+
35+# No keep alive
36+# See https://github.com/searx/searx-docker/issues/24
37+add-header = Connection: close
docs/_themes/searx/static/searx.cssnew file+130
@@ -0,0 +1,130 @@
1+@import url("pocoo.css");
2+
3+a, a.reference, a.footnote-reference {
4+ color: #004b6b;
5+ border-color: #004b6b;
6+}
7+
8+a:hover {
9+ color: #6d4100;
10+ border-color: #6d4100;
11+}
12+
13+p.version-warning {
14+ background-color: #004b6b;
15+}
16+
17+div.sidebar {
18+ background-color: whitesmoke;
19+ border-color: lightsteelblue;
20+ border-radius: 3pt;
21+}
22+
23+p.sidebar-title, .sidebar p {
24+ margin: 6pt;
25+}
26+
27+.sidebar li,
28+.hlist li {
29+ list-style-type: disclosure-closed;
30+}
31+
32+
33+/* admonitions
34+*/
35+
36+div.admonition, div.topic {
37+ background-color: #fafafa;
38+ margin: 8px 0px;
39+ padding: 1em;
40+ border-radius: 3pt 0 0 3pt;
41+ border-top: none;
42+ border-right: none;
43+ border-bottom: none;
44+ border-left: 5pt solid #ccc;
45+}
46+
47+p.admonition-title:after {
48+ content: none;
49+}
50+
51+.admonition.hint { border-color: #416dc0b0; }
52+.admonition.note { border-color: #6c856cb0; }
53+.admonition.tip { border-color: #85c5c2b0; }
54+.admonition.attention { border-color: #ecec97b0; }
55+.admonition.caution { border-color: #a6c677b0; }
56+.admonition.danger { border-color: #d46262b0; }
57+.admonition.important { border-color: #dfa3a3b0; }
58+.admonition.error { border-color: red; }
59+.admonition.warning { border-color: darkred; }
60+
61+.admonition.admonition-generic-admonition-title {
62+ border-color: #416dc0b0;
63+}
64+
65+
66+/* admonitions with (rendered) reST markup examples (:class: rst-example)
67+ *
68+ * .. admonition:: title of the example
69+ * :class: rst-example
70+ * ....
71+*/
72+
73+div.rst-example {
74+ background-color: inherit;
75+ margin: 0;
76+ border-top: none;
77+ border-right: 1px solid #ccc;
78+ border-bottom: none;
79+ border-left: none;
80+ border-radius: none;
81+ padding: 0;
82+}
83+
84+div.rst-example > p.admonition-title {
85+ font-family: Sans Serif;
86+ font-style: italic;
87+ font-size: 0.8em;
88+ display: block;
89+ border-bottom: 1px solid #ccc;
90+ padding: 0.5em 1em;
91+ text-align: right;
92+}
93+
94+/* code block in figures
95+ */
96+
97+div.highlight pre {
98+ text-align: left;
99+}
100+
101+/* Table theme
102+*/
103+
104+thead, tfoot {
105+ background-color: #fff;
106+}
107+
108+th:hover, td:hover {
109+ background-color: #ffc;
110+}
111+
112+thead th, tfoot th, tfoot td, tbody th {
113+ background-color: #fffaef;
114+}
115+
116+tbody tr:nth-child(odd) {
117+ background-color: #fff;
118+}
119+
120+tbody tr:nth-child(even) {
121+ background-color: #fafafa;
122+}
123+
124+caption {
125+ font-family: Sans Serif;
126+ padding: 0.5em;
127+ margin: 0.5em 0 0.5em 0;
128+ caption-side: top;
129+ text-align: left;
130+}
docs/_themes/searx/theme.confnew file+6
@@ -0,0 +1,6 @@
1+[theme]
2+inherit = pocoo
3+stylesheet = searx.css
4+
5+[options]
6+touch_icon =
docs/admin/api.rstnew file+96
@@ -0,0 +1,96 @@
1+.. _adminapi:
2+
3+==================
4+Administration API
5+==================
6+
7+Get configuration data
8+======================
9+
10+.. code:: http
11+
12+ GET /config HTTP/1.1
13+
14+Sample response
15+---------------
16+
17+.. code:: json
18+
19+ {
20+ "autocomplete": "",
21+ "categories": [
22+ "map",
23+ "it",
24+ "images",
25+ ],
26+ "default_locale": "",
27+ "default_theme": "oscar",
28+ "engines": [
29+ {
30+ "categories": [
31+ "map"
32+ ],
33+ "enabled": true,
34+ "name": "openstreetmap",
35+ "shortcut": "osm"
36+ },
37+ {
38+ "categories": [
39+ "it"
40+ ],
41+ "enabled": true,
42+ "name": "arch linux wiki",
43+ "shortcut": "al"
44+ },
45+ {
46+ "categories": [
47+ "images"
48+ ],
49+ "enabled": true,
50+ "name": "google images",
51+ "shortcut": "goi"
52+ },
53+ {
54+ "categories": [
55+ "it"
56+ ],
57+ "enabled": false,
58+ "name": "bitbucket",
59+ "shortcut": "bb"
60+ },
61+ ],
62+ "instance_name": "searx",
63+ "locales": {
64+ "de": "Deutsch (German)",
65+ "en": "English",
66+ "eo": "Esperanto (Esperanto)",
67+ },
68+ "plugins": [
69+ {
70+ "enabled": true,
71+ "name": "HTTPS rewrite"
72+ },
73+ {
74+ "enabled": false,
75+ "name": "Vim-like hotkeys"
76+ }
77+ ],
78+ "safe_search": 0
79+ }
80+
81+
82+Embed search bar
83+================
84+
85+The search bar can be embedded into websites. Just paste the example into the
86+HTML of the site. URL of the searx instance and values are customizable.
87+
88+.. code:: html
89+
90+ <form method="post" action="https://searx.me/">
91+ <!-- search --> <input type="text" name="q" />
92+ <!-- categories --> <input type="hidden" name="categories" value="general,social media" />
93+ <!-- language --> <input type="hidden" name="lang" value="all" />
94+ <!-- locale --> <input type="hidden" name="locale" value="en" />
95+ <!-- date filter --> <input type="hidden" name="time_range" value="month" />
96+ </form>
docs/admin/arch_public.dotnew file+33
@@ -0,0 +1,33 @@
1+digraph G {
2+
3+ node [style=filled, shape=box, fillcolor="#ffffcc", fontname="Sans"];
4+ edge [fontname="Sans"];
5+
6+ browser [label="Browser", shape=Mdiamond];
7+ rp [label="Reverse Proxy", href="url to configure reverse proxy"];
8+ filtron [label="Filtron", href="https://github.com/asciimoo/filtron"];
9+ morty [label="Morty", href="https://github.com/asciimoo/morty"];
10+ static [label="Static files", href="url to configure static files"];
11+ uwsgi [label="uwsgi", href="url to configure uwsgi"]
12+ searx1 [label="Searx #1"];
13+ searx2 [label="Searx #2"];
14+ searx3 [label="Searx #3"];
15+ searx4 [label="Searx #4"];
16+
17+ browser -> rp [label="HTTPS"]
18+
19+ subgraph cluster_searx {
20+ label = "Searx instance" fontname="Sans";
21+ bgcolor="#fafafa";
22+ { rank=same; static rp };
23+ rp -> morty [label="optional: images and HTML pages proxy"];
24+ rp -> static [label="optional: reverse proxy serves directly static files"];
25+ rp -> filtron [label="HTTP"];
26+ filtron -> uwsgi [label="HTTP"];
27+ uwsgi -> searx1;
28+ uwsgi -> searx2;
29+ uwsgi -> searx3;
30+ uwsgi -> searx4;
31+ }
32+
33+}
docs/admin/architecture.rstnew file+24
@@ -0,0 +1,24 @@
1+.. _architecture:
2+
3+============
4+Architecture
5+============
6+
7+.. sidebar:: Needs work!
8+
9+ This article needs some work / Searx is a collaborative effort. If you have
10+ any contribution, feel welcome to send us your :pull:`PR <../pulls>`, see
11+ :ref:`how to contribute`.
12+
13+Herein you will find some hints and suggestions about typical architectures of
14+searx infrastructures.
15+
16+We start with a contribution from :pull:`@dalf <1776#issuecomment-567917320>`.
17+It shows a *reference* setup for public searx instances.
18+
19+.. _arch public:
20+
21+.. kernel-figure:: arch_public.dot
22+ :alt: arch_public.dot
23+
24+ Reference architecture of a public searx setup.
docs/admin/buildhosts.rstnew file+103
@@ -0,0 +1,103 @@
1+.. _buildhosts:
2+
3+==========
4+Buildhosts
5+==========
6+
7+.. sidebar:: This article needs some work
8+
9+ If you have any contribution send us your :pull:`PR <../pulls>`, see
10+ :ref:`how to contribute`.
11+
12+To get best results from build, its recommend to install additional packages
13+on build hosts.
14+
15+.. _docs build:
16+
17+Build docs
18+==========
19+
20+.. _Graphviz: https://graphviz.gitlab.io
21+.. _ImageMagick: https://www.imagemagick.org
22+.. _XeTeX: https://tug.org/xetex/
23+.. _dvisvgm: https://dvisvgm.de/
24+
25+.. sidebar:: Sphinx build needs
26+
27+ - ImageMagick_
28+ - Graphviz_
29+ - XeTeX_
30+ - dvisvgm_
31+
32+Most of the sphinx requirements are installed from :origin:`setup.py` and the
33+docs can be build from scratch with ``make docs``. For better math and image
34+processing additional packages are needed. The XeTeX_ needed not only for PDF
35+creation, its also needed for :ref:`math` when HTML output is build.
36+
37+To be able to do :ref:`sphinx:math-support` without CDNs, the math are rendered
38+as images (``sphinx.ext.imgmath`` extension). If your docs build (``make
39+docs``) shows warnings like this::
40+
41+ WARNING: dot(1) not found, for better output quality install \
42+ graphviz from http://www.graphviz.org
43+ ..
44+ WARNING: LaTeX command 'latex' cannot be run (needed for math \
45+ display), check the imgmath_latex setting
46+
47+you need to install additional packages on your build host, to get better HTML
48+output.
49+
50+.. _system requirements:
51+
52+.. tabs::
53+
54+ .. group-tab:: Ubuntu / debian
55+
56+ .. code-block:: sh
57+
58+ $ sudo apt install graphviz imagemagick texlive-xetex librsvg2-bin
59+
60+ .. group-tab:: Arch Linux
61+
62+ .. code-block:: sh
63+
64+ $ sudo pacman -S graphviz imagemagick texlive-bin extra/librsvg
65+
66+ .. group-tab:: Fedora / RHEL
67+
68+ .. code-block:: sh
69+
70+ $ sudo dnf install graphviz graphviz-gd texlive-xetex-bin librsvg2-tools
71+
72+
73+For PDF output you also need:
74+
75+.. tabs::
76+
77+ .. group-tab:: Ubuntu / debian
78+
79+ .. code:: sh
80+
81+ $ sudo apt texlive-latex-recommended texlive-extra-utils ttf-dejavu
82+
83+ .. group-tab:: Arch Linux
84+
85+ .. code:: sh
86+
87+ $ sudo pacman -S texlive-core texlive-latexextra ttf-dejavu
88+
89+ .. group-tab:: Fedora / RHEL
90+
91+ .. code:: sh
92+
93+ $ sudo dnf install \
94+ texlive-collection-fontsrecommended texlive-collection-latex \
95+ dejavu-sans-fonts dejavu-serif-fonts dejavu-sans-mono-fonts
96+
97+.. _system requirements END:
98+
99+.. literalinclude:: ../conf.py
100+ :language: python
101+ :start-after: # sphinx.ext.imgmath setup
102+ :end-before: # sphinx.ext.imgmath setup END
103+
docs/admin/engines.rstnew file+71
@@ -0,0 +1,71 @@
1+.. _engines generic:
2+
3+=======
4+Engines
5+=======
6+
7+.. sidebar:: Further reading ..
8+
9+ - :ref:`settings engine`
10+ - :ref:`engine settings`
11+ - :ref:`engine file`
12+
13+============= =========== ==================== ============
14+:ref:`engine settings` :ref:`engine file`
15+------------------------- ---------------------------------
16+Name (cfg) Categories
17+------------------------- ---------------------------------
18+Engine .. Paging support **P**
19+------------------------- -------------------- ------------
20+Shortcut **S** Language support **L**
21+Timeout **TO** Time range support **TR**
22+Disabled **D** Offline **O**
23+------------- ----------- -------------------- ------------
24+Safe search **SS**
25+------------- ----------- ---------------------------------
26+Weigth **W**
27+------------- ----------- ---------------------------------
28+Disabled **D**
29+============= =========== =================================
30+
31+Configuration defaults (at built time):
32+
33+.. _configured engines:
34+
35+.. jinja:: webapp
36+
37+ .. flat-table:: Engines configured at built time (defaults)
38+ :header-rows: 1
39+ :stub-columns: 2
40+
41+ * - Name (cfg)
42+ - S
43+ - Engine
44+ - TO
45+ - Categories
46+ - P
47+ - L
48+ - SS
49+ - D
50+ - TR
51+ - O
52+ - W
53+ - D
54+
55+ {% for name, mod in engines.items() %}
56+
57+ * - {{name}}
58+ - !{{mod.shortcut}}
59+ - {{mod.__name__}}
60+ - {{mod.timeout}}
61+ - {{", ".join(mod.categories)}}
62+ - {{(mod.paging and "y") or ""}}
63+ - {{(mod.language_support and "y") or ""}}
64+ - {{(mod.safesearch and "y") or ""}}
65+ - {{(mod.disabled and "y") or ""}}
66+ - {{(mod.time_range_support and "y") or ""}}
67+ - {{(mod.offline and "y") or ""}}
68+ - {{mod.weight or 1 }}
69+ - {{(mod.disabled and "y") or ""}}
70+
71+ {% endfor %}
docs/admin/filtron.rstnew file+148
@@ -0,0 +1,148 @@
1+==========================
2+How to protect an instance
3+==========================
4+
5+Searx depens on external search services. To avoid the abuse of these services
6+it is advised to limit the number of requests processed by searx.
7+
8+An application firewall, ``filtron`` solves exactly this problem. Information
9+on how to install it can be found at the `project page of filtron
10+<https://github.com/asciimoo/filtron>`__.
11+
12+
13+Sample configuration of filtron
14+===============================
15+
16+An example configuration can be find below. This configuration limits the access
17+of:
18+
19+- scripts or applications (roboagent limit)
20+- webcrawlers (botlimit)
21+- IPs which send too many requests (IP limit)
22+- too many json, csv, etc. requests (rss/json limit)
23+- the same UserAgent of if too many requests (useragent limit)
24+
25+.. code:: json
26+
27+ [{
28+ "name":"search request",
29+ "filters":[
30+ "Param:q",
31+ "Path=^(/|/search)$"
32+ ],
33+ "interval":"<time-interval-in-sec (int)>",
34+ "limit":"<max-request-number-in-interval (int)>",
35+ "subrules":[
36+ {
37+ "name":"roboagent limit",
38+ "interval":"<time-interval-in-sec (int)>",
39+ "limit":"<max-request-number-in-interval (int)>",
40+ "filters":[
41+ "Header:User-Agent=(curl|cURL|Wget|python-requests|Scrapy|FeedFetcher|Go-http-client)"
42+ ],
43+ "actions":[
44+ {
45+ "name":"block",
46+ "params":{
47+ "message":"Rate limit exceeded"
48+ }
49+ }
50+ ]
51+ },
52+ {
53+ "name":"botlimit",
54+ "limit":0,
55+ "stop":true,
56+ "filters":[
57+ "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)"
58+ ],
59+ "actions":[
60+ {
61+ "name":"block",
62+ "params":{
63+ "message":"Rate limit exceeded"
64+ }
65+ }
66+ ]
67+ },
68+ {
69+ "name":"IP limit",
70+ "interval":"<time-interval-in-sec (int)>",
71+ "limit":"<max-request-number-in-interval (int)>",
72+ "stop":true,
73+ "aggregations":[
74+ "Header:X-Forwarded-For"
75+ ],
76+ "actions":[
77+ {
78+ "name":"block",
79+ "params":{
80+ "message":"Rate limit exceeded"
81+ }
82+ }
83+ ]
84+ },
85+ {
86+ "name":"rss/json limit",
87+ "interval":"<time-interval-in-sec (int)>",
88+ "limit":"<max-request-number-in-interval (int)>",
89+ "stop":true,
90+ "filters":[
91+ "Param:format=(csv|json|rss)"
92+ ],
93+ "actions":[
94+ {
95+ "name":"block",
96+ "params":{
97+ "message":"Rate limit exceeded"
98+ }
99+ }
100+ ]
101+ },
102+ {
103+ "name":"useragent limit",
104+ "interval":"<time-interval-in-sec (int)>",
105+ "limit":"<max-request-number-in-interval (int)>",
106+ "aggregations":[
107+ "Header:User-Agent"
108+ ],
109+ "actions":[
110+ {
111+ "name":"block",
112+ "params":{
113+ "message":"Rate limit exceeded"
114+ }
115+ }
116+ ]
117+ }
118+ ]
119+ }]
120+
121+
122+
123+Route request through filtron
124+=============================
125+
126+Filtron can be started using the following command:
127+
128+.. code:: sh
129+
130+ $ filtron -rules rules.json
131+
132+It listens on ``127.0.0.1:4004`` and forwards filtered requests to
133+``127.0.0.1:8888`` by default.
134+
135+Use it along with ``nginx`` with the following example configuration.
136+
137+.. code:: nginx
138+
139+ location / {
140+ proxy_set_header Host $http_host;
141+ proxy_set_header X-Real-IP $remote_addr;
142+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
143+ proxy_set_header X-Scheme $scheme;
144+ proxy_pass http://127.0.0.1:4004/;
145+ }
146+
147+Requests are coming from port 4004 going through filtron and then forwarded to
148+port 8888 where a searx is being run.
docs/admin/index.rstnew file+16
@@ -0,0 +1,16 @@
1+===========================
2+Administrator documentation
3+===========================
4+
5+.. toctree::
6+ :maxdepth: 1
7+
8+ installation
9+ settings
10+ api
11+ architecture
12+ filtron
13+ morty
14+ engines
15+ plugins
16+ buildhosts
docs/admin/installation.rstnew file+349
@@ -0,0 +1,349 @@
1+.. _installation:
2+
3+============
4+Installation
5+============
6+
7+.. contents::
8+ :depth: 3
9+
10+Basic installation
11+==================
12+
13+Step by step installation for Debian/Ubuntu with virtualenv. For Ubuntu, be sure
14+to have enable universe repository.
15+
16+Install packages:
17+
18+.. code:: sh
19+
20+ $ sudo -H apt-get install \
21+ git build-essential libxslt-dev \
22+ python-dev python-virtualenv python-babel \
23+ zlib1g-dev libffi-dev libssl-dev
24+
25+Install searx:
26+
27+.. code:: sh
28+
29+ cd /usr/local
30+ sudo -H git clone https://github.com/asciimoo/searx.git
31+ sudo -H useradd searx -d /usr/local/searx
32+ sudo -H chown searx:searx -R /usr/local/searx
33+
34+Install dependencies in a virtualenv:
35+
36+.. code:: sh
37+
38+ cd /usr/local/searx
39+ sudo -H -u searx -i
40+
41+.. code:: sh
42+
43+ (searx)$ virtualenv searx-ve
44+ (searx)$ . ./searx-ve/bin/activate
45+ (searx)$ ./manage.sh update_packages
46+
47+Configuration
48+==============
49+
50+.. code:: sh
51+
52+ sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
53+
54+Edit searx/settings.yml if necessary.
55+
56+Check
57+=====
58+
59+Start searx:
60+
61+.. code:: sh
62+
63+ python searx/webapp.py
64+
65+Go to http://localhost:8888
66+
67+If everything works fine, disable the debug option in settings.yml:
68+
69+.. code:: sh
70+
71+ sed -i -e "s/debug : True/debug : False/g" searx/settings.yml
72+
73+At this point searx is not demonized ; uwsgi allows this.
74+
75+You can exit the virtualenv and the searx user bash (enter exit command
76+twice).
77+
78+uwsgi
79+=====
80+
81+Install packages:
82+
83+.. code:: sh
84+
85+ sudo -H apt-get install \
86+ uwsgi uwsgi-plugin-python
87+
88+Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this
89+content:
90+
91+.. code:: ini
92+
93+ [uwsgi]
94+ # Who will run the code
95+ uid = searx
96+ gid = searx
97+
98+ # disable logging for privacy
99+ disable-logging = true
100+
101+ # Number of workers (usually CPU count)
102+ workers = 4
103+
104+ # The right granted on the created socket
105+ chmod-socket = 666
106+
107+ # Plugin to use and interpretor config
108+ single-interpreter = true
109+ master = true
110+ plugin = python
111+ lazy-apps = true
112+ enable-threads = true
113+
114+ # Module to import
115+ module = searx.webapp
116+
117+ # Support running the module from a webserver subdirectory.
118+ route-run = fixpathinfo:
119+
120+ # Virtualenv and python path
121+ virtualenv = /usr/local/searx/searx-ve/
122+ pythonpath = /usr/local/searx/
123+ chdir = /usr/local/searx/searx/
124+
125+Activate the uwsgi application and restart:
126+
127+.. code:: sh
128+
129+ cd /etc/uwsgi/apps-enabled
130+ ln -s ../apps-available/searx.ini
131+ /etc/init.d/uwsgi restart
132+
133+Web server
134+==========
135+
136+with nginx
137+----------
138+
139+If nginx is not installed (uwsgi will not work with the package
140+nginx-light):
141+
142+.. code:: sh
143+
144+ sudo -H apt-get install nginx
145+
146+Hosted at /
147+~~~~~~~~~~~
148+
149+Create the configuration file ``/etc/nginx/sites-available/searx`` with this
150+content:
151+
152+.. code:: nginx
153+
154+ server {
155+ listen 80;
156+ server_name searx.example.com;
157+ root /usr/local/searx/searx;
158+
159+ location /static {
160+ }
161+
162+ location / {
163+ include uwsgi_params;
164+ uwsgi_pass unix:/run/uwsgi/app/searx/socket;
165+ }
166+ }
167+
168+Create a symlink to sites-enabled:
169+
170+.. code:: sh
171+
172+ sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
173+
174+Restart service:
175+
176+.. code:: sh
177+
178+ sudo -H service nginx restart
179+ sudo -H service uwsgi restart
180+
181+from subdirectory URL (/searx)
182+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
183+
184+Add this configuration in the server config file
185+``/etc/nginx/sites-enabled/default``:
186+
187+.. code:: nginx
188+
189+ location /searx/static {
190+ alias /usr/local/searx/searx/static;
191+ }
192+
193+ location /searx {
194+ uwsgi_param SCRIPT_NAME /searx;
195+ include uwsgi_params;
196+ uwsgi_pass unix:/run/uwsgi/app/searx/socket;
197+ }
198+
199+
200+**OR** using reverse proxy (Please, note that reverse proxy advised to be used
201+in case of single-user or low-traffic instances.)
202+
203+.. code:: nginx
204+
205+ location /searx/static {
206+ alias /usr/local/searx/searx/static;
207+ }
208+
209+ location /searx {
210+ proxy_pass http://127.0.0.1:8888;
211+ proxy_set_header Host $host;
212+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
213+ proxy_set_header X-Scheme $scheme;
214+ proxy_set_header X-Script-Name /searx;
215+ proxy_buffering off;
216+ }
217+
218+
219+Enable ``base_url`` in ``searx/settings.yml``
220+
221+.. code:: yaml
222+
223+ base_url : http://your.domain.tld/searx/
224+
225+Restart service:
226+
227+.. code:: sh
228+
229+ sudo -H service nginx restart
230+ sudo -H service uwsgi restart
231+
232+disable logs
233+^^^^^^^^^^^^
234+
235+for better privacy you can disable nginx logs about searx.
236+
237+how to proceed: below ``uwsgi_pass`` in ``/etc/nginx/sites-available/default``
238+add:
239+
240+.. code:: nginx
241+
242+ access_log /dev/null;
243+ error_log /dev/null;
244+
245+Restart service:
246+
247+.. code:: sh
248+
249+ sudo -H service nginx restart
250+
251+with apache
252+-----------
253+
254+Add wsgi mod:
255+
256+.. code:: sh
257+
258+ sudo -H apt-get install libapache2-mod-uwsgi
259+ sudo -H a2enmod uwsgi
260+
261+Add this configuration in the file ``/etc/apache2/apache2.conf``:
262+
263+.. code:: apache
264+
265+ <Location />
266+ Options FollowSymLinks Indexes
267+ SetHandler uwsgi-handler
268+ uWSGISocket /run/uwsgi/app/searx/socket
269+ </Location>
270+
271+Note that if your instance of searx is not at the root, you should change
272+``<Location />`` by the location of your instance, like ``<Location /searx>``.
273+
274+Restart Apache:
275+
276+.. code:: sh
277+
278+ sudo -H /etc/init.d/apache2 restart
279+
280+disable logs
281+~~~~~~~~~~~~
282+
283+For better privacy you can disable Apache logs.
284+
285+.. warning::
286+
287+ You can only disable logs for the whole (virtual) server not for a specific
288+ path.
289+
290+Go back to ``/etc/apache2/apache2.conf`` and above ``<Location />`` add:
291+
292+.. code:: apache
293+
294+ CustomLog /dev/null combined
295+
296+Restart Apache:
297+
298+.. code:: sh
299+
300+ sudo -H /etc/init.d/apache2 restart
301+
302+How to update
303+=============
304+
305+.. code:: sh
306+
307+ cd /usr/local/searx
308+ sudo -H -u searx -i
309+
310+.. code:: sh
311+
312+ (searx)$ . ./searx-ve/bin/activate
313+ (searx)$ git stash
314+ (searx)$ git pull origin master
315+ (searx)$ git stash apply
316+ (searx)$ ./manage.sh update_packages
317+
318+.. code:: sh
319+
320+ sudo -H service uwsgi restart
321+
322+Docker
323+======
324+
325+Make sure you have installed Docker. For instance, you can deploy searx like this:
326+
327+.. code:: sh
328+
329+ docker pull wonderfall/searx
330+ docker run -d --name searx -p $PORT:8888 wonderfall/searx
331+
332+Go to ``http://localhost:$PORT``.
333+
334+See https://hub.docker.com/r/wonderfall/searx/ for more informations. It's also
335+possible to build searx from the embedded Dockerfile.
336+
337+.. code:: sh
338+
339+ git clone https://github.com/asciimoo/searx.git
340+ cd searx
341+ docker build -t whatever/searx .
342+
343+References
344+==========
345+
346+* https://about.okhin.fr/posts/Searx/ with some additions
347+
348+* How to: `Setup searx in a couple of hours with a free SSL certificate
349+ <https://www.reddit.com/r/privacytoolsIO/comments/366kvn/how_to_setup_your_own_privacy_respecting_search/>`__
docs/admin/morty.rstnew file+26
@@ -0,0 +1,26 @@
1+=========================
2+How to setup result proxy
3+=========================
4+
5+.. _morty: https://github.com/asciimoo/morty
6+.. _morty's README: https://github.com/asciimoo/morty
7+
8+By default searx can only act as an image proxy for result images, but it is
9+possible to proxify all the result URLs with an external service, morty_.
10+
11+To use this feature, morty has to be installed and activated in searx's
12+``settings.yml``.
13+
14+Add the following snippet to your ``settings.yml`` and restart searx:
15+
16+.. code:: yaml
17+
18+ result_proxy:
19+ url : http://127.0.0.1:3000/
20+ key : your_morty_proxy_key
21+
22+``url``
23+ Is the address of the running morty service.
24+
25+``key``
26+ Is an optional argument, see `morty's README`_ for more information.
docs/admin/plugins.rstnew file+39
@@ -0,0 +1,39 @@
1+.. _plugins generic:
2+
3+===============
4+Plugins builtin
5+===============
6+
7+.. sidebar:: Further reading ..
8+
9+ - :ref:`dev plugin`
10+
11+Configuration defaults (at built time):
12+
13+:DO: Default on
14+
15+.. _configured plugins:
16+
17+.. jinja:: webapp
18+
19+ .. flat-table:: Plugins configured at built time (defaults)
20+ :header-rows: 1
21+ :stub-columns: 1
22+ :widths: 3 1 9
23+
24+ * - Name
25+ - DO
26+ - Description
27+
28+ JS & CSS dependencies
29+
30+ {% for plgin in plugins %}
31+
32+ * - {{plgin.name}}
33+ - {{(plgin.default_on and "y") or ""}}
34+ - {{plgin.description}}
35+
36+ {% for dep in (plgin.js_dependencies + plgin.css_dependencies) %}
37+ | ``{{dep}}`` {% endfor %}
38+
39+ {% endfor %}
docs/admin/settings.rstnew file+181
@@ -0,0 +1,181 @@
1+.. _settings.yml:
2+
3+================
4+``settings.yml``
5+================
6+
7+.. sidebar:: Further reading ..
8+
9+ - :ref:`search API`
10+
11+This page describe the options possibilities of the settings.yml file.
12+
13+.. _settings global:
14+
15+Global Settings
16+===============
17+
18+.. code:: yaml
19+
20+ server:
21+ port : 8888
22+ secret_key : "ultrasecretkey" # change this!
23+ debug : False # debug mode, only for development
24+ request_timeout : 2.0 # seconds
25+ base_url : False # set custom base_url (or False)
26+ themes_path : "" # custom ui themes path
27+ default_theme : oscar # ui theme
28+ useragent_suffix : "" # suffix of searx_useragent, could contain
29+ # informations like admins email address
30+ image_proxy : False # proxying image results through searx
31+ default_locale : "" # default interface locale
32+
33+ # uncomment below section if you want to use a proxy
34+
35+ #outgoing_proxies :
36+ # http : http://127.0.0.1:8080
37+ # https: http://127.0.0.1:8080
38+
39+ # uncomment below section only if you have more than one network interface
40+ # which can be the source of outgoing search requests
41+
42+ #source_ips:
43+ # - 1.1.1.1
44+ # - 1.1.1.2
45+
46+ locales:
47+ en : English
48+ de : Deutsch
49+ he : Hebrew
50+ hu : Magyar
51+ fr : Français
52+ es : Español
53+ it : Italiano
54+ nl : Nederlands
55+ ja : 日本語 (Japanese)
56+ tr : Türkçe
57+ ru : Russian
58+ ro : Romanian
59+
60+
61+``port`` :
62+ Port number of the searx web application if you run it directly using ``python
63+ searx/webapp.py``. Doesn't apply to searx running on Apache or Nginx.
64+
65+``secret_key`` :
66+ Used for cryptography purpose.
67+
68+``debug`` :
69+ Allow a more detailed log if you run searx directly. Display *detailed* error
70+ messages in the browser too, so this must be deactivated in production.
71+
72+``request_timeout`` :
73+ Global timeout of the requests made to others engines in seconds. A bigger
74+ timeout will allow to wait for answers from slow engines, but in consequence
75+ will slow searx reactivity (the result page may take the time specified in the
76+ timeout to load)
77+
78+``base_url`` :
79+ The base URL where searx is deployed. Used to create correct inbound links.
80+
81+``themes_path`` :
82+ Path to where the themes are located. If you didn't develop anything, leave it
83+ blank.
84+
85+``default_theme`` :
86+ Name of the theme you want to use by default on you searx instance.
87+
88+``useragent_suffix`` :
89+ Suffix to the user-agent searx uses to send requests to others engines. If an
90+ engine wish to block you, a contact info here may be useful to avoid that.
91+
92+``image_proxy`` :
93+ Allow your instance of searx of being able to proxy images. Uses memory space.
94+
95+``default_locale`` :
96+ Aearx interface language. If blank, the locale is detected by using the
97+ browser language. If it doesn't work, or you are deploying a language
98+ specific instance of searx, a locale can be defined using an ISO language
99+ code, like ``fr``, ``en``, ``de``.
100+
101+.. _requests proxies: http://docs.python-requests.org/en/latest/user/advanced/#proxies
102+.. _PR SOCKS support: https://github.com/kennethreitz/requests/pull/478
103+
104+``outgoing_proxies`` :
105+ Define a proxy you wish to use, see `requests proxies`_. SOCKS proxies are
106+ not supported / see `PR SOCKS support`.
107+
108+``source_ips`` :
109+ If you use multiple nework interfaces, define from which IP the requests must
110+ be made.
111+
112+``locales`` :
113+ Locales codes and their names. Available translations of searx interface.
114+
115+
116+.. _settings engine:
117+
118+Engine settings
119+===============
120+
121+.. sidebar:: Further reading ..
122+
123+ - :ref:`engines-dev`
124+
125+.. code:: yaml
126+
127+ - name : bing
128+ engine : bing
129+ shortcut : bi
130+ base_url : 'https://{language}.wikipedia.org/'
131+ categories : general
132+ timeout : 3.0
133+ api_key : 'apikey'
134+ disabled : True
135+ language : en_US
136+
137+``name`` :
138+ Name that will be used accross searx to define this engine. In settings, on
139+ the result page...
140+
141+``engine`` :
142+ Name of the python file used to handle requests and responses to and from this
143+ search engine.
144+
145+``shortcut`` :
146+ Code used to execute bang requests (in this case using ``!bi`` or ``?bi``)
147+
148+``base_url`` : optional
149+ Part of the URL that should be stable accross every request. Can be useful to
150+ use multiple sites using only one engine, or updating the site URL without
151+ touching at the code.
152+
153+``categories`` : optional
154+ Define in which categories this engine will be active. Most of the time, it is
155+ defined in the code of the engine, but in a few cases it is useful, like when
156+ describing multiple search engine using the same code.
157+
158+``timeout`` : optional
159+ Timeout of the search with the current search engine. **Be careful, it will
160+ modify the global timeout of searx.**
161+
162+``api_key`` : optional
163+ In a few cases, using an API needs the use of a secret key. How to obtain them
164+ is described in the file.
165+
166+``disabled`` : optional
167+ To disable by default the engine, but not deleting it. It will allow the user
168+ to manually activate it in the settings.
169+
170+``language`` : optional
171+ If you want to use another language for a specific engine, you can define it
172+ by using the full ISO code of language and country, like ``fr_FR``, ``en_US``,
173+ ``de_DE``.
174+
175+``weigth`` : default ``1``
176+ Weighting of the results of this engine.
177+
178+.. note::
179+
180+ A few more options are possible, but they are pretty specific to some
181+ engines, and so won't be described here.
docs/blog/admin.rstnew file+43
@@ -0,0 +1,43 @@
1+=============================================================
2+Searx admin interface
3+=============================================================
4+
5+.. _searx-admin: https://github.com/kvch/searx-admin#searx-admin
6+.. _NLnet Foundation: https://nlnet.nl/
7+
8+ manage your instance from your browser
9+
10+.. sidebar:: Installation
11+
12+ Installation guide can be found in the repository of searx-admin_.
13+
14+One of the biggest advantages of searx is being extremely customizable. But at
15+first it can be daunting to newcomers. A barrier of taking advantage of this
16+feature is our ugly settings file which is sometimes hard to understand and
17+edit.
18+
19+To make self-hosting searx more accessible a new tool is introduced, called
20+``searx-admin``. It is a web application which is capable of managing your
21+instance and manipulating its settings via a web UI. It aims to replace editing
22+of ``settings.yml`` for less experienced administrators or people who prefer
23+graphical admin interfaces.
24+
25+.. figure:: searx-admin-engines.png
26+ :alt: Screenshot of engine list
27+
28+ Configuration page of engines
29+
30+Since ``searx-admin`` acts as a supervisor for searx, we have decided to
31+implement it as a standalone tool instead of part of searx. Another reason for
32+making it a standalone tool is that the codebase and dependencies of searx
33+should not grow because of a fully optional feature, which does not affect
34+existing instances.
35+
36+
37+Acknowledgements
38+================
39+
40+This development was sponsored by `NLnet Foundation`_.
41+
42+| Happy hacking.
43+| kvch // 2017.08.22 21:25
docs/blog/index.rstnew file+11
@@ -0,0 +1,11 @@
1+====
2+Blog
3+====
4+
5+.. toctree::
6+ :maxdepth: 1
7+
8+ python3
9+ admin
10+ intro-offline
11+ private-engines
docs/blog/intro-offline.rstnew file+77
@@ -0,0 +1,77 @@
1+===============================
2+Preparation for offline engines
3+===============================
4+
5+Offline engines
6+===============
7+
8+To extend the functionality of searx, offline engines are going to be
9+introduced. An offline engine is an engine which does not need Internet
10+connection to perform a search and does not use HTTP to communicate.
11+
12+Offline engines can be configured as online engines, by adding those to the
13+`engines` list of :origin:`settings.yml <searx/settings.yml>`. Thus, searx
14+finds the engine file and imports it.
15+
16+Example skeleton for the new engines:
17+
18+.. code:: python
19+
20+ from subprocess import PIPE, Popen
21+
22+ categories = ['general']
23+ offline = True
24+
25+ def init(settings):
26+ pass
27+
28+ def search(query, params):
29+ process = Popen(['ls', query], stdout=PIPE)
30+ return_code = process.wait()
31+ if return_code != 0:
32+ raise RuntimeError('non-zero return code', return_code)
33+
34+ results = []
35+ line = process.stdout.readline()
36+ while line:
37+ result = parse_line(line)
38+ results.append(results)
39+
40+ line = process.stdout.readline()
41+
42+ return results
43+
44+
45+Development progress
46+====================
47+
48+First, a proposal has been created as a Github issue. Then it was moved to the
49+wiki as a design document. You can read it here: :wiki:`Offline-engines`.
50+
51+In this development step, searx core was prepared to accept and perform offline
52+searches. Offline search requests are scheduled together with regular offline
53+requests.
54+
55+As offline searches can return arbitrary results depending on the engine, the
56+current result templates were insufficient to present such results. Thus, a new
57+template is introduced which is caplable of presenting arbitrary key value pairs
58+as a table. You can check out the pull request for more details see
59+:pull:`1700`.
60+
61+Next steps
62+==========
63+
64+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.
65+
66+Acknowledgement
67+===============
68+
69+This development was sponsored by `Search and Discovery Fund`_ of `NLnet Foundation`_ .
70+
71+.. _Search and Discovery Fund: https://nlnet.nl/discovery
72+.. _NLnet Foundation: https://nlnet.nl/
73+
74+
75+| Happy hacking.
76+| kvch // 2019.10.21 17:03
77+
docs/blog/private-engines.rstnew file+63
@@ -0,0 +1,63 @@
1+==================================
2+Limit access to your searx engines
3+==================================
4+
5+Administrators might find themselves wanting to limit access to some of the
6+enabled engines on their instances. It might be because they do not want to
7+expose some private information through an offline engine. Or they
8+would rather share engines only with their trusted friends or colleagues.
9+
10+Private engines
11+===============
12+
13+To solve this issue private engines were introduced in :pull:`1823`.
14+A new option was added to engines named `tokens`. It expects a list
15+of strings. If the user making a request presents one of the tokens
16+of an engine, he/she is able to access information about the engine
17+and make search requests.
18+
19+Example configuration to restrict access to the Arch Linux Wiki engine:
20+
21+.. code:: yaml
22+
23+ - name : arch linux wiki
24+ engine : archlinux
25+ shortcut : al
26+ tokens : [ 'my-secret-token' ]
27+
28+
29+Unless a user has configured the right token, the engine is going
30+to be hidden from him/her. It is not going to be included in the
31+list of engines on the Preferences page and in the output of
32+`/config` REST API call.
33+
34+Tokens can be added to one's configuration on the Preferences page
35+under "Engine tokens". The input expects a comma separated list of
36+strings.
37+
38+The distribution of the tokens from the administrator to the users
39+is not carved in stone. As providing access to such engines
40+implies that the admin knows and trusts the user, we do not see
41+necessary to come up with a strict process. Instead,
42+we would like to add guidelines to the documentation of the feature.
43+
44+Next steps
45+==========
46+
47+Now that searx has support for both offline engines and private engines,
48+it is possible to add concrete engines which benefit from these features.
49+For example engines which search on the local host running the instance.
50+Be it searching your file system or querying a private database. Be creative
51+and come up with new solutions which fit your use case.
52+
53+Acknowledgement
54+===============
55+
56+This development was sponsored by `Search and Discovery Fund`_ of `NLnet Foundation`_ .
57+
58+.. _Search and Discovery Fund: https://nlnet.nl/discovery
59+.. _NLnet Foundation: https://nlnet.nl/
60+
61+
62+| Happy hacking.
63+| kvch // 2020.02.28 22:26
docs/blog/python3.rstnew file+68
@@ -0,0 +1,68 @@
1+============================
2+Introducing Python 3 support
3+============================
4+
5+.. _Python 2.7 clock: https://pythonclock.org/
6+
7+.. sidebar:: Python 2.7 to 3 upgrade
8+
9+ This chapter exists of historical reasons. Python 2.7 release schedule ends
10+ (`Python 2.7 clock`_) after 11 years Python 3 exists
11+
12+As most operation systems are coming with Python3 installed by default. So it is
13+time for searx to support Python3. But don't worry support of Python2.7 won't be
14+dropped.
15+
16+.. image:: searxpy3.png
17+ :scale: 50 %
18+ :alt: hurray
19+ :align: center
20+
21+
22+How to run searx using Python 3
23+===============================
24+
25+Please make sure that you run at least Python 3.5.
26+
27+To run searx, first a Python3 virtualenv should be created. After entering the
28+virtualenv, dependencies must be installed. Then run searx with python3 instead
29+of the usual python command.
30+
31+.. code:: sh
32+
33+ virtualenv -p python3 venv3
34+ source venv3/bin/activate
35+ pip3 install -r requirements.txt
36+ python3 searx/webapp.py
37+
38+
39+If you want to run searx using Python2.7, you don't have to do anything
40+differently as before.
41+
42+Fun facts
43+=========
44+
45+- 115 files were changed when implementing the support for both Python versions.
46+
47+- All of the dependencies was compatible except for the robotframework used for
48+ browser tests. Thus, these tests were migrated to splinter. So from now on
49+ both versions are being tested on Travis and can be tested locally.
50+
51+If you found bugs
52+=================
53+
54+Please open an issue on `GitHub`_. Make sure that you mention your Python
55+version in your issue, so we can investigate it properly.
56+
57+.. _GitHub: https://github.com/asciimoo/searx/issues
58+
59+Acknowledgment
60+==============
61+
62+This development was sponsored by `NLnet Foundation`_.
63+
64+.. _NLnet Foundation: https://nlnet.nl/
65+
66+
67+| Happy hacking.
68+| kvch // 2017.05.13 22:57
docs/blog/searx-admin-engines.pngnew file

Binary file not shown.

docs/blog/searxpy3.pngnew file

Binary file not shown.

docs/conf.pynew file+114
@@ -0,0 +1,114 @@
1+# -*- coding: utf-8 -*-
2+
3+import sys, os
4+from searx.version import VERSION_STRING
5+from pallets_sphinx_themes import ProjectLink
6+
7+from searx.brand import GIT_URL
8+from searx.brand import SEARX_URL
9+from searx.brand import DOCS_URL
10+
11+# Project --------------------------------------------------------------
12+
13+project = u'searx'
14+copyright = u'2015-2020, Adam Tauber, Noémi Ványi'
15+author = u'Adam Tauber'
16+release, version = VERSION_STRING, VERSION_STRING
17+highlight_language = 'none'
18+
19+# General --------------------------------------------------------------
20+
21+master_doc = "index"
22+source_suffix = '.rst'
23+numfig = True
24+
25+from searx import webapp
26+jinja_contexts = {
27+ 'webapp': dict(**webapp.__dict__)
28+}
29+
30+# usage:: lorem :patch:`f373169` ipsum
31+extlinks = {}
32+
33+# upstream links
34+extlinks['wiki'] = ('https://github.com/asciimoo/searx/wiki/%s', ' ')
35+extlinks['pull'] = ('https://github.com/asciimoo/searx/pull/%s', 'PR ')
36+
37+# links to custom brand
38+extlinks['origin'] = (GIT_URL + '/blob/master/%s', 'git://')
39+extlinks['patch'] = (GIT_URL + '/commit/%s', '#')
40+extlinks['search'] = (SEARX_URL + '/%s', '#')
41+extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ')
42+extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ')
43+extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '')
44+#extlinks['role'] = (
45+# 'https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-%s', '')
46+extlinks['duref'] = (
47+ 'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#%s', '')
48+extlinks['durole'] = (
49+ 'http://docutils.sourceforge.net/docs/ref/rst/roles.html#%s', '')
50+extlinks['dudir'] = (
51+ 'http://docutils.sourceforge.net/docs/ref/rst/directives.html#%s', '')
52+extlinks['ctan'] = (
53+ 'https://ctan.org/pkg/%s', 'CTAN: ')
54+
55+extensions = [
56+ 'sphinx.ext.imgmath',
57+ 'sphinx.ext.extlinks',
58+ 'sphinx.ext.viewcode',
59+ "sphinx.ext.autodoc",
60+ "sphinx.ext.intersphinx",
61+ "pallets_sphinx_themes",
62+ "sphinx_issues", # https://github.com/sloria/sphinx-issues/blob/master/README.rst
63+ "sphinxcontrib.jinja", # https://github.com/tardyp/sphinx-jinja
64+ 'linuxdoc.rstFlatTable', # Implementation of the 'flat-table' reST-directive.
65+ 'linuxdoc.kfigure', # Sphinx extension which implements scalable image handling.
66+ "sphinx_tabs.tabs", # https://github.com/djungelorm/sphinx-tabs
67+]
68+
69+intersphinx_mapping = {
70+ "python": ("https://docs.python.org/3/", None),
71+ "flask": ("https://flask.palletsprojects.com/", None),
72+ # "werkzeug": ("https://werkzeug.palletsprojects.com/", None),
73+ "jinja": ("https://jinja.palletsprojects.com/", None),
74+ "linuxdoc" : ("https://return42.github.io/linuxdoc/", None),
75+ "sphinx" : ("https://www.sphinx-doc.org/en/master/", None),
76+}
77+
78+issues_github_path = "asciimoo/searx"
79+
80+# HTML -----------------------------------------------------------------
81+
82+sys.path.append(os.path.abspath('_themes'))
83+html_theme_path = ['_themes']
84+html_theme = "searx"
85+
86+# sphinx.ext.imgmath setup
87+html_math_renderer = 'imgmath'
88+imgmath_image_format = 'svg'
89+imgmath_font_size = 14
90+# sphinx.ext.imgmath setup END
91+
92+html_theme_options = {"index_sidebar_logo": True}
93+html_context = {
94+ "project_links": [
95+ ProjectLink("Source", GIT_URL),
96+ ProjectLink("Wiki", "https://github.com/asciimoo/searx/wiki"),
97+ ProjectLink("Public instances", "https://searx.space/"),
98+ ProjectLink("Twitter", "https://twitter.com/Searx_engine"),
99+ ]
100+}
101+html_sidebars = {
102+ "**": ["project.html", "relations.html", "searchbox.html"],
103+}
104+singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}
105+html_static_path = ["static"]
106+html_logo = "static/img/searx_logo_small.png"
107+html_title = "Searx Documentation ({})".format("Searx-{}.tex".format(VERSION_STRING))
108+html_show_sourcelink = False
109+
110+# LaTeX ----------------------------------------------------------------
111+
112+latex_documents = [
113+ (master_doc, "searx-{}.tex".format(VERSION_STRING), html_title, author, "manual")
114+]
docs/dev/contribution_guide.rstnew file+180
@@ -0,0 +1,180 @@
1+.. _how to contribute:
2+
3+=================
4+How to contribute
5+=================
6+
7+Prime directives: Privacy, Hackability
8+======================================
9+
10+Searx has two prime directives, **privacy-by-design and hackability** . The
11+hackability comes in three levels:
12+
13+- support of search engines
14+- plugins to alter search behaviour
15+- hacking searx itself
16+
17+Note the lack of "world domination" among the directives. Searx has no
18+intention of wide mass-adoption, rounded corners, etc. The prime directive
19+"privacy" deserves a separate chapter, as it's quite uncommon unfortunately.
20+
21+Privacy-by-design
22+-----------------
23+
24+Searx was born out of the need for a **privacy-respecting** search tool which
25+can be extended easily to maximize both, its search and its privacy protecting
26+capabilities.
27+
28+A few widely used features work differently or turned off by default or not
29+implemented at all **as a consequence of privacy-by-design**.
30+
31+If a feature reduces the privacy preserving aspects of searx, it should be
32+switched off by default or should not implemented at all. There are plenty of
33+search engines already providing such features. If a feature reduces the
34+protection of searx, users must be informed about the effect of choosing to
35+enable it. Features that protect privacy but differ from the expectations of
36+the user should also be explained.
37+
38+Also, if you think that something works weird with searx, it's might be because
39+of the tool you use is designed in a way to interfere with the privacy respect.
40+Submitting a bugreport to the vendor of the tool that misbehaves might be a good
41+feedback to reconsider the disrespect to its customers (e.g. ``GET`` vs ``POST``
42+requests in various browsers).
43+
44+Remember the other prime directive of searx is to be hackable, so if the above
45+privacy concerns do not fancy you, simply fork it.
46+
47+ *Happy hacking.*
48+
49+Code
50+====
51+
52+.. _PEP8: https://www.python.org/dev/peps/pep-0008/
53+.. _Conventional Commits: https://www.conventionalcommits.org/
54+.. _Git Commit Good Practice: https://wiki.openstack.org/wiki/GitCommitMessages
55+.. _Structural split of changes:
56+ https://wiki.openstack.org/wiki/GitCommitMessages#Structural_split_of_changes
57+.. _gitmoji: https://gitmoji.carloscuesta.me/
58+.. _Semantic PR: https://github.com/zeke/semantic-pull-requests
59+
60+.. sidebar:: Create good commits!
61+
62+ - `Structural split of changes`_
63+ - `Conventional Commits`_
64+ - `Git Commit Good Practice`_
65+ - some like to use: gitmoji_
66+ - not yet active: `Semantic PR`_
67+
68+In order to submit a patch, please follow the steps below:
69+
70+- Follow coding conventions.
71+
72+ - PEP8_ standards apply, except the convention of line length
73+ - Maximum line length is 120 characters
74+
75+- The cardinal rule for creating good commits is to ensure there is only one
76+ *logical change* per commit / read `Structural split of changes`_
77+
78+- Check if your code breaks existing tests. If so, update the tests or fix your
79+ code.
80+
81+- If your code can be unit-tested, add unit tests.
82+
83+- Add yourself to the :origin:`AUTHORS.rst` file.
84+
85+- Choose meaning full commit messages, read `Conventional Commits`_
86+
87+ .. code::
88+
89+ <type>[optional scope]: <description>
90+
91+ [optional body]
92+
93+ [optional footer(s)]
94+
95+- Create a pull request.
96+
97+For more help on getting started with searx development, see :ref:`devquickstart`.
98+
99+
100+Translation
101+===========
102+
103+Translation currently takes place on :ref:`transifex <translation>`.
104+
105+.. caution::
106+
107+ Please, do not update translation files in the repo.
108+
109+
110+.. _contrib docs:
111+
112+Documentation
113+=============
114+
115+.. _Sphinx: http://www.sphinx-doc.org
116+.. _reST: http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
117+
118+.. sidebar:: The reST sources
119+
120+ has been moved from ``gh-branch`` into ``master`` (:origin:`docs`).
121+
122+The documentation is built using Sphinx_. So in order to be able to generate
123+the required files, you have to install it on your system. Much easier, use
124+our :ref:`makefile`.
125+
126+Here is an example which makes a complete rebuild:
127+
128+.. code:: sh
129+
130+ $ make docs-clean docs
131+ ...
132+ The HTML pages are in dist/docs.
133+
134+.. _make docs-live:
135+
136+live build
137+----------
138+
139+.. sidebar:: docs-clean
140+
141+ It is recommended to assert a complete rebuild before deploying (use
142+ ``docs-clean``).
143+
144+Live build is like WYSIWYG. If you want to edit the documentation, its
145+recommended to use. The Makefile target ``docs-live`` builds the docs, opens
146+URL in your favorite browser and rebuilds every time a reST file has been
147+changed.
148+
149+.. code:: sh
150+
151+ $ make docs-live
152+ ...
153+ The HTML pages are in dist/docs.
154+ ... Serving on http://0.0.0.0:8080
155+ ... Start watching changes
156+
157+
158+.. _deploy on github.io:
159+
160+deploy on github.io
161+-------------------
162+
163+To deploy documentation at :docs:`github.io <.>` use Makefile target
164+:ref:`make gh-pages`, which will builds the documentation, clones searx into a sub
165+folder ``gh-pages``, cleans it, copies the doc build into and runs all the
166+needed git add, commit and push:
167+
168+.. code:: sh
169+
170+ $ make docs-clean gh-pages
171+ ...
172+ SPHINX docs --> file://<...>/dist/docs
173+ The HTML pages are in dist/docs.
174+ ...
175+ Cloning into 'gh-pages' ...
176+ ...
177+ cd gh-pages; git checkout gh-pages >/dev/null
178+ Switched to a new branch 'gh-pages'
179+ ...
180+ doc available at --> https://asciimoo.github.io/searx
docs/dev/csv_table.txtnew file+6
@@ -0,0 +1,6 @@
1+stub col row 1, column, "loremLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
2+eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
3+voluptua."
4+stub col row 1, "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
5+kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.", column
6+stub col row 1, column, column
docs/dev/engine_overview.rstnew file+267
@@ -0,0 +1,267 @@
1+
2+.. _engines-dev:
3+
4+===============
5+Engine overview
6+===============
7+
8+.. _metasearch-engine: https://en.wikipedia.org/wiki/Metasearch_engine
9+
10+searx is a metasearch-engine_, so it uses different search engines to provide
11+better results.
12+
13+Because there is no general search API which could be used for every search
14+engine, an adapter has to be built between searx and the external search
15+engines. Adapters are stored under the folder :origin:`searx/engines`.
16+
17+.. contents::
18+ :depth: 3
19+ :backlinks: entry
20+
21+general engine configuration
22+============================
23+
24+It is required to tell searx the type of results the engine provides. The
25+arguments can be set in the engine file or in the settings file
26+(normally ``settings.yml``). The arguments in the settings file override
27+the ones in the engine file.
28+
29+It does not matter if an option is stored in the engine file or in the
30+settings. However, the standard way is the following:
31+
32+.. _engine file:
33+
34+engine file
35+-----------
36+
37+======================= =========== ===========================================
38+argument type information
39+======================= =========== ===========================================
40+categories list pages, in which the engine is working
41+paging boolean support multible pages
42+language_support boolean support language choosing
43+time_range_support boolean support search time range
44+offline boolean engine runs offline
45+======================= =========== ===========================================
46+
47+.. _engine settings:
48+
49+settings.yml
50+------------
51+
52+======================= =========== ===========================================
53+argument type information
54+======================= =========== ===========================================
55+name string name of search-engine
56+engine string name of searx-engine
57+ (filename without ``.py``)
58+shortcut string shortcut of search-engine
59+timeout string specific timeout for search-engine
60+======================= =========== ===========================================
61+
62+
63+overrides
64+---------
65+
66+A few of the options have default values in the engine, but are often
67+overwritten by the settings. If ``None`` is assigned to an option in the engine
68+file, it has to be redefined in the settings, otherwise searx will not start
69+with that engine.
70+
71+The naming of overrides is arbitrary. But the recommended overrides are the
72+following:
73+
74+======================= =========== ===========================================
75+argument type information
76+======================= =========== ===========================================
77+base_url string base-url, can be overwritten to use same
78+ engine on other URL
79+number_of_results int maximum number of results per request
80+language string ISO code of language and country like en_US
81+api_key string api-key if required by engine
82+======================= =========== ===========================================
83+
84+example code
85+------------
86+
87+.. code:: python
88+
89+ # engine dependent config
90+ categories = ['general']
91+ paging = True
92+ language_support = True
93+
94+
95+making a request
96+================
97+
98+To perform a search an URL have to be specified. In addition to specifying an
99+URL, arguments can be passed to the query.
100+
101+passed arguments
102+----------------
103+
104+These arguments can be used to construct the search query. Furthermore,
105+parameters with default value can be redefined for special purposes.
106+
107+====================== ============ ========================================================================
108+argument type default-value, information
109+====================== ============ ========================================================================
110+url string ``''``
111+method string ``'GET'``
112+headers set ``{}``
113+data set ``{}``
114+cookies set ``{}``
115+verify boolean ``True``
116+headers.User-Agent string a random User-Agent
117+category string current category, like ``'general'``
118+started datetime current date-time
119+pageno int current pagenumber
120+language string specific language code like ``'en_US'``, or ``'all'`` if unspecified
121+====================== ============ ========================================================================
122+
123+parsed arguments
124+----------------
125+
126+The function ``def request(query, params):`` always returns the ``params``
127+variable. Inside searx, the following paramters can be used to specify a search
128+request:
129+
130+============ =========== =========================================================
131+argument type information
132+============ =========== =========================================================
133+url string requested url
134+method string HTTP request method
135+headers set HTTP header information
136+data set HTTP data information (parsed if ``method != 'GET'``)
137+cookies set HTTP cookies
138+verify boolean Performing SSL-Validity check
139+============ =========== =========================================================
140+
141+
142+example code
143+------------
144+
145+.. code:: python
146+
147+ # search-url
148+ base_url = 'https://example.com/'
149+ search_string = 'search?{query}&page={page}'
150+
151+ # do search-request
152+ def request(query, params):
153+ search_path = search_string.format(
154+ query=urlencode({'q': query}),
155+ page=params['pageno'])
156+
157+ params['url'] = base_url + search_path
158+
159+ return params
160+
161+
162+returned results
163+================
164+
165+Searx is able to return results of different media-types. Currently the
166+following media-types are supported:
167+
168+- default_
169+- images_
170+- videos_
171+- torrent_
172+- map_
173+
174+To set another media-type as default, the parameter ``template`` must be set to
175+the desired type.
176+
177+default
178+-------
179+
180+========================= =====================================================
181+result-parameter information
182+========================= =====================================================
183+url string, url of the result
184+title string, title of the result
185+content string, general result-text
186+publishedDate :py:class:`datetime.datetime`, time of publish
187+========================= =====================================================
188+
189+images
190+------
191+
192+To use this template, the parameter:
193+
194+========================= =====================================================
195+result-parameter information
196+========================= =====================================================
197+template is set to ``images.html``
198+url string, url to the result site
199+title string, title of the result *(partly implemented)*
200+content *(partly implemented)*
201+publishedDate :py:class:`datetime.datetime`,
202+ time of publish *(partly implemented)*
203+img\_src string, url to the result image
204+thumbnail\_src string, url to a small-preview image
205+========================= =====================================================
206+
207+videos
208+------
209+
210+========================= =====================================================
211+result-parameter information
212+========================= =====================================================
213+template is set to ``videos.html``
214+url string, url of the result
215+title string, title of the result
216+content *(not implemented yet)*
217+publishedDate :py:class:`datetime.datetime`, time of publish
218+thumbnail string, url to a small-preview image
219+========================= =====================================================
220+
221+torrent
222+-------
223+
224+.. _magnetlink: https://en.wikipedia.org/wiki/Magnet_URI_scheme
225+
226+========================= =====================================================
227+result-parameter information
228+========================= =====================================================
229+template is set to ``torrent.html``
230+url string, url of the result
231+title string, title of the result
232+content string, general result-text
233+publishedDate :py:class:`datetime.datetime`,
234+ time of publish *(not implemented yet)*
235+seed int, number of seeder
236+leech int, number of leecher
237+filesize int, size of file in bytes
238+files int, number of files
239+magnetlink string, magnetlink_ of the result
240+torrentfile string, torrentfile of the result
241+========================= =====================================================
242+
243+
244+map
245+---
246+
247+========================= =====================================================
248+result-parameter information
249+========================= =====================================================
250+url string, url of the result
251+title string, title of the result
252+content string, general result-text
253+publishedDate :py:class:`datetime.datetime`, time of publish
254+latitude latitude of result (in decimal format)
255+longitude longitude of result (in decimal format)
256+boundingbox boundingbox of result (array of 4. values
257+ ``[lat-min, lat-max, lon-min, lon-max]``)
258+geojson geojson of result (http://geojson.org)
259+osm.type type of osm-object (if OSM-Result)
260+osm.id id of osm-object (if OSM-Result)
261+address.name name of object
262+address.road street name of object
263+address.house_number house number of object
264+address.locality city, place of object
265+address.postcode postcode of object
266+address.country country of object
267+========================= =====================================================
docs/dev/hello.dotnew file+3
@@ -0,0 +1,3 @@
1+graph G {
2+ Hello -- World
3+}
docs/dev/index.rstnew file+15
@@ -0,0 +1,15 @@
1+=======================
2+Developer documentation
3+=======================
4+
5+.. toctree::
6+ :maxdepth: 1
7+
8+ quickstart
9+ contribution_guide
10+ engine_overview
11+ search_api
12+ plugins
13+ translation
14+ makefile
15+ reST
docs/dev/makefile.rstnew file+221
@@ -0,0 +1,221 @@
1+.. _makefile:
2+
3+================
4+Makefile Targets
5+================
6+
7+.. _gnu-make: https://www.gnu.org/software/make/manual/make.html#Introduction
8+
9+.. sidebar:: build environment
10+
11+ Before looking deeper at the targets, first read about :ref:`makefile setup`
12+ and :ref:`make pyenv`.
13+
14+With the aim to simplify development cycles, started with :pull:`1756` a
15+``Makefile`` based boilerplate was added. If you are not familiar with
16+Makefiles, we recommend to read gnu-make_ introduction.
17+
18+The usage is simple, just type ``make {target-name}`` to *build* a target.
19+Calling the ``help`` target gives a first overview::
20+
21+ $ make help
22+ test - run developer tests
23+ docs - build documentation
24+ docs-live - autobuild HTML documentation while editing
25+ run - run developer instance
26+ install - developer install (./local)
27+ uninstall - uninstall (./local)
28+ gh-pages - build docs & deploy on gh-pages branch
29+ clean - drop builds and environments
30+ ...
31+
32+.. contents:: Contents
33+ :depth: 2
34+ :local:
35+ :backlinks: entry
36+
37+
38+.. _makefile setup:
39+
40+Setup
41+=====
42+
43+.. _git stash: https://git-scm.com/docs/git-stash
44+
45+The main setup is done in the :origin:`Makefile`::
46+
47+ export GIT_URL=https://github.com/asciimoo/searx
48+ export SEARX_URL=https://searx.me
49+ export DOCS_URL=https://asciimoo.github.io/searx
50+
51+.. sidebar:: fork & upstream
52+
53+ Commit changes in your (local) branch, fork or whatever, but do not push them
54+ upstream / `git stash`_ is your friend.
55+
56+:GIT_URL: Changes this, to point to your searx fork.
57+
58+:SEARX_URL: Changes this, to point to your searx instance.
59+
60+:DOCS_URL: If you host your own (branded) documentation, change this URL.
61+
62+.. _make pyenv:
63+
64+Python environment
65+==================
66+
67+.. sidebar:: activate environment
68+
69+ ``source ./local/py3/bin/activate``
70+
71+With Makefile we do no longer need to build up the virualenv manually (as
72+described in the :ref:`devquickstart` guide). Jump into your git working tree
73+and release a ``make pyenv``:
74+
75+.. code:: sh
76+
77+ $ cd ~/searx-clone
78+ $ make pyenv
79+ PYENV usage: source ./local/py3/bin/activate
80+ ...
81+
82+With target ``pyenv`` a development environment (aka virtualenv) was build up in
83+``./local/py3/``. To make a *developer install* of searx (:origin:`setup.py`)
84+into this environment, use make target ``install``:
85+
86+.. code:: sh
87+
88+ $ make install
89+ PYENV usage: source ./local/py3/bin/activate
90+ PYENV using virtualenv from ./local/py3
91+ PYENV install .
92+
93+You have never to think about intermediate targets like ``pyenv`` or
94+``install``, the ``Makefile`` chains them as requisites. Just run your main
95+target.
96+
97+.. sidebar:: drop environment
98+
99+ To get rid of the existing environment before re-build use :ref:`clean target
100+ <make clean>` first.
101+
102+If you think, something goes wrong with your ./local environment or you change
103+the :origin:`setup.py` file (or the requirements listed in
104+:origin:`requirements-dev.txt` and :origin:`requirements.txt`), you have to call
105+:ref:`make clean`.
106+
107+
108+.. _make run:
109+
110+``make run``
111+============
112+
113+To get up a running a developer instance simply call ``make run``. This enables
114+*debug* option in :origin:`searx/settings.yml`, starts a ``./searx/webapp.py``
115+instance, disables *debug* option again and opens the URL in your favorite WEB
116+browser (:man:`xdg-open`):
117+
118+.. code:: sh
119+
120+ $ make run
121+ PYENV usage: source ./local/py3/bin/activate
122+ PYENV install .
123+ ./local/py3/bin/python ./searx/webapp.py
124+ ...
125+ INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)
126+ ...
127+
128+.. _make clean:
129+
130+``make clean``
131+==============
132+
133+Drop all intermediate files, all builds, but keep sources untouched. Includes
134+target ``pyclean`` which drops ./local environment. Before calling ``make
135+clean`` stop all processes using :ref:`make pyenv`.
136+
137+.. code:: sh
138+
139+ $ make clean
140+ CLEAN pyclean
141+ CLEAN clean
142+
143+.. _make docs:
144+
145+``make docs docs-live docs-clean``
146+==================================
147+
148+We describe the usage of the ``doc*`` targets in the :ref:`How to contribute /
149+Documentation <contrib docs>` section. If you want to edit the documentation
150+read our :ref:`make docs-live` section. If you are working in your own brand,
151+adjust your :ref:`Makefile setup <makefile setup>`.
152+
153+
154+.. _make gh-pages:
155+
156+``make gh-pages``
157+=================
158+
159+To deploy on github.io first adjust your :ref:`Makefile setup <makefile
160+setup>`. For any further read :ref:`deploy on github.io`.
161+
162+.. _make test:
163+
164+``make test``
165+=============
166+
167+Runs a series of tests: ``test.pep8``, ``test.unit``, ``test.robot`` and does
168+additional :ref:`pylint checks <make pylint>`. You can run tests selective,
169+e.g.:
170+
171+.. code:: sh
172+
173+ $ make test.pep8 test.unit
174+ . ./local/py3/bin/activate; ./manage.sh pep8_check
175+ [!] Running pep8 check
176+ . ./local/py3/bin/activate; ./manage.sh unit_tests
177+ [!] Running unit tests
178+
179+.. _make pylint:
180+
181+``make pylint``
182+===============
183+
184+.. _Pylint: https://www.pylint.org/
185+
186+Before commiting its recommend to do some (more) linting. Pylint_ is known as
187+one of the best source-code, bug and quality checker for the Python programming
188+language. Pylint_ is not yet a quality gate within our searx project (like
189+:ref:`test.pep8 <make test>` it is), but Pylint_ can help to improve code
190+quality anyway. The pylint profile we use at searx project is found in
191+project's root folder :origin:`.pylintrc`.
192+
193+Code quality is a ongoing process. Don't try to fix all messages from Pylint,
194+run Pylint and check if your changed lines are bringing up new messages. If so,
195+fix it. By this, code quality gets incremental better and if there comes the
196+day, the linting is balanced out, we might decide to add Pylint as a quality
197+gate.
198+
199+
200+``make pybuild``
201+================
202+
203+.. _PyPi: https://pypi.org/
204+.. _twine: https://twine.readthedocs.io/en/latest/
205+
206+Build Python packages in ``./dist/py``.
207+
208+.. code:: sh
209+
210+ $ make pybuild
211+ ...
212+ BUILD pybuild
213+ running sdist
214+ running egg_info
215+ ...
216+ $ ls ./dist/py/
217+ searx-0.15.0-py3-none-any.whl searx-0.15.0.tar.gz
218+
219+To upload packages to PyPi_, there is also a ``upload-pypi`` target. It needs
220+twine_ to be installed. Since you are not the owner of :pypi:`searx` you will
221+never need the latter.
docs/dev/plugins.rstnew file+54
@@ -0,0 +1,54 @@
1+.. _dev plugin:
2+
3+=======
4+Plugins
5+=======
6+
7+.. sidebar:: Further reading ..
8+
9+ - :ref:`plugins generic`
10+
11+Plugins can extend or replace functionality of various components of searx.
12+
13+Example plugin
14+==============
15+
16+.. code:: python
17+
18+ name = 'Example plugin'
19+ description = 'This plugin extends the suggestions with the word "example"'
20+ default_on = False # disabled by default
21+
22+ js_dependencies = tuple() # optional, list of static js files
23+ css_dependencies = tuple() # optional, list of static css files
24+
25+
26+ # attach callback to the post search hook
27+ # request: flask request object
28+ # ctx: the whole local context of the post search hook
29+ def post_search(request, ctx):
30+ ctx['search'].suggestions.add('example')
31+ return True
32+
33+Plugin entry points
34+===================
35+
36+Entry points (hooks) define when a plugin runs. Right now only three hooks are
37+implemented. So feel free to implement a hook if it fits the behaviour of your
38+plugin.
39+
40+Pre search hook
41+---------------
42+
43+Runs BEFORE the search request. Function to implement: ``pre_search``
44+
45+Post search hook
46+----------------
47+
48+Runs AFTER the search request. Function to implement: ``post_search``
49+
50+Result hook
51+-----------
52+
53+Runs when a new result is added to the result list. Function to implement:
54+``on_result``
docs/dev/quickstart.rstnew file+132
@@ -0,0 +1,132 @@
1+.. _devquickstart:
2+
3+======================
4+Development Quickstart
5+======================
6+
7+.. sidebar:: :ref:`makefile`
8+
9+ For additional developer purpose there are :ref:`makefile`.
10+
11+This quickstart guide gets your environment set up with searx. Furthermore, it
12+gives a short introduction to the ``manage.sh`` script.
13+
14+How to setup your development environment
15+=========================================
16+
17+.. sidebar:: :ref:`make pyenv <make pyenv>`
18+
19+ Alternatively use the :ref:`make pyenv`.
20+
21+First, clone the source code of searx to the desired folder. In this case the
22+source is cloned to ``~/myprojects/searx``. Then create and activate the
23+searx-ve virtualenv and install the required packages using ``manage.sh``.
24+
25+.. code:: sh
26+
27+ cd ~/myprojects
28+ git clone https://github.com/asciimoo/searx.git
29+ cd searx
30+ virtualenv searx-ve
31+ . ./searx-ve/bin/activate
32+ ./manage.sh update_dev_packages
33+
34+
35+How to run tests
36+================
37+
38+.. sidebar:: :ref:`make test.unit <make test>`
39+
40+ Alternatively use the ``test.pep8``, ``test.unit``, ``test.robot`` targets.
41+
42+Tests can be run using the ``manage.sh`` script. Following tests and checks are
43+available:
44+
45+- Unit tests
46+- Selenium tests
47+- PEP8 validation
48+- Unit test coverage check
49+
50+For example unit tests are run with the command below:
51+
52+.. code:: sh
53+
54+ ./manage.sh unit_tests
55+
56+For further test options, please consult the help of the ``manage.sh`` script or
57+read :ref:`make test`.
58+
59+
60+How to compile styles and javascript
61+====================================
62+
63+.. _less: http://lesscss.org/
64+.. _NodeJS: https://nodejs.org
65+
66+How to build styles
67+-------------------
68+
69+Less_ is required to build the styles of searx. Less_ can be installed using
70+either NodeJS_ or Apt.
71+
72+.. code:: sh
73+
74+ sudo -H apt-get install nodejs
75+ sudo -H npm install -g less
76+
77+OR
78+
79+.. code:: sh
80+
81+ sudo -H apt-get install node-less
82+
83+After satisfying the requirements styles can be build using ``manage.sh``
84+
85+.. code:: sh
86+
87+ ./manage.sh styles
88+
89+
90+How to build the source of the themes
91+=====================================
92+
93+.. _grunt: https://gruntjs.com/
94+
95+Grunt_ must be installed in order to build the javascript sources. It depends on
96+NodeJS, so first Node has to be installed.
97+
98+.. code:: sh
99+
100+ sudo -H apt-get install nodejs
101+ make node.env
102+
103+After installing grunt, the files can be built using the following command:
104+
105+.. code:: sh
106+
107+ make themes
108+
109+
110+Tips for debugging/development
111+==============================
112+
113+.. sidebar:: :ref:`make run`
114+
115+ Makefile target ``run`` already enables debug option for your developer
116+ session / see :ref:`make run`.
117+
118+Turn on debug logging
119+ Whether you are working on a new engine or trying to eliminate a bug, it is
120+ always a good idea to turn on debug logging. When debug logging is enabled a
121+ stack trace appears, instead of the cryptic ``Internal Server Error``
122+ message. It can be turned on by setting ``debug: False`` to ``debug: True`` in
123+ :origin:`settings.yml <searx/settings.yml>`.
124+
125+.. sidebar:: :ref:`make test`
126+
127+ Alternatively use the :ref:`make test` targets.
128+
129+Run ``./manage.sh tests`` before creating a PR.
130+ Failing build on Travis is common because of PEP8 checks. So a new commit
131+ must be created containing these format fixes. This phase can be skipped if
132+ ``./manage.sh tests`` is run locally before creating a PR.
docs/dev/reST.rstnew file+1428
@@ -0,0 +1,1428 @@
1+.. _reST primer:
2+
3+===========
4+reST primer
5+===========
6+
7+.. sidebar:: KISS_ and readability_
8+
9+ Instead of defining more and more roles, we at searx encourage our
10+ contributors to follow principles like KISS_ and readability_.
11+
12+We at searx are using reStructuredText (aka reST_) markup for all kind of
13+documentation, with the builders from the Sphinx_ project a HTML output is
14+generated and deployed at :docs:`github.io <.>`. For build prerequisites read
15+:ref:`docs build`.
16+
17+The source files of Searx's documentation are located at :origin:`docs`. Sphinx
18+assumes source files to be encoded in UTF-8 by defaul. Run :ref:`make docs-live
19+<make docs-live>` to build HTML while editing.
20+
21+.. sidebar:: Further reading
22+
23+ - Sphinx-Primer_
24+ - `Sphinx markup constructs`_
25+ - reST_, docutils_, `docutils FAQ`_
26+ - Sphinx_, `sphinx-doc FAQ`_
27+ - `sphinx config`_, doctree_
28+ - `sphinx cross references`_
29+ - linuxdoc_
30+ - intersphinx_
31+ - sphinx-jinja_
32+ - `Sphinx's autodoc`_
33+ - `Sphinx's Python domain`_, `Sphinx's C domain`_
34+ - SVG_, ImageMagick_
35+ - DOT_, `Graphviz's dot`_, Graphviz_
36+
37+
38+.. contents:: Contents
39+ :depth: 3
40+ :local:
41+ :backlinks: entry
42+
43+Sphinx_ and reST_ have their place in the python ecosystem. Over that reST is
44+used in popular projects, e.g the Linux kernel documentation `[kernel doc]`_.
45+
46+.. _[kernel doc]: https://www.kernel.org/doc/html/latest/doc-guide/sphinx.html
47+
48+.. sidebar:: Content matters
49+
50+ The readability_ of the reST sources has its value, therefore we recommend to
51+ make sparse usage of reST markup / .. content matters!
52+
53+**reST** is a plaintext markup language, its markup is *mostly* intuitive and
54+you will not need to learn much to produce well formed articles with. I use the
55+word *mostly*: like everything in live, reST has its advantages and
56+disadvantages, some markups feel a bit grumpy (especially if you are used to
57+other plaintext markups).
58+
59+Soft skills
60+===========
61+
62+Before going any deeper into the markup let's face on some **soft skills** a
63+trained author brings with, to reach a well feedback from readers:
64+
65+- Documentation is dedicated to an audience and answers questions from the
66+ audience point of view.
67+- Don't detail things which are general knowledge from the audience point of
68+ view.
69+- Limit the subject, use cross links for any further reading.
70+
71+To be more concrete what a *point of view* means. In the (:origin:`docs`)
72+folder we have three sections (and the *blog* folder), each dedicate to a
73+different group of audience.
74+
75+User's POV: :origin:`docs/user`
76+ A typical user knows about search engines and might have heard about
77+ meta crawlers and privacy.
78+
79+Admin's POV: :origin:`docs/admin`
80+ A typical Admin knows about setting up services on a linux system, but he does
81+ not know all the pros and cons of a searx setup.
82+
83+Developer's POV: :origin:`docs/dev`
84+ Depending on the readability_ of code, a typical developer is able to read and
85+ understand source code. Describe what a item aims to do (e.g. a function).
86+ If the chronological order matters, describe it. Name the *out-of-limits
87+ conditions* and all the side effects a external developer will not know.
88+
89+.. _reST inline markup:
90+
91+Basic inline markup
92+===================
93+
94+.. sidebar:: Inline markup
95+
96+ - :ref:`reST roles`
97+ - :ref:`reST smart ref`
98+
99+Basic inline markup is done with asterisks and backquotes. If asterisks or
100+backquotes appear in running text and could be confused with inline markup
101+delimiters, they have to be escaped with a backslash (``\*pointer``).
102+
103+.. table:: basic inline markup
104+ :widths: 4 3 7
105+
106+ ================================================ ==================== ========================
107+ description rendered markup
108+ ================================================ ==================== ========================
109+ one asterisk for emphasis *italics* ``*italics*``
110+ two asterisks for strong emphasis **boldface** ``**boldface**``
111+ backquotes for code samples and literals ``foo()`` ````foo()````
112+ quote asterisks or backquotes \*foo is a pointer ``\*foo is a pointer``
113+ ================================================ ==================== ========================
114+
115+.. _reST basic structure:
116+
117+Basic article structure
118+=======================
119+
120+The basic structure of an article makes use of heading adornments to markup
121+chapter, sections and subsections.
122+
123+.. _reST template:
124+
125+reST template
126+-------------
127+
128+reST template for an simple article:
129+
130+.. code:: reST
131+
132+ .. _doc refname:
133+
134+ ==============
135+ Document title
136+ ==============
137+
138+ Lorem ipsum dolor sit amet, consectetur adipisici elit .. Further read
139+ :ref:`chapter refname`.
140+
141+ .. _chapter refname:
142+
143+ Chapter
144+ =======
145+
146+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
147+ aliquid ex ea commodi consequat ...
148+
149+ .. _section refname:
150+
151+ Section
152+ -------
153+
154+ lorem ..
155+
156+ .. _subsection refname:
157+
158+ Subsection
159+ ~~~~~~~~~~
160+
161+ lorem ..
162+
163+
164+Headings
165+--------
166+
167+#. title - with overline for document title:
168+
169+ .. code:: reST
170+
171+ ==============
172+ Document title
173+ ==============
174+
175+
176+#. chapter - with anchor named ``anchor name``:
177+
178+ .. code:: reST
179+
180+ .. _anchor name:
181+
182+ Chapter
183+ =======
184+
185+#. section
186+
187+ .. code:: reST
188+
189+ Section
190+ -------
191+
192+#. subsection
193+
194+ .. code:: reST
195+
196+ Subsection
197+ ~~~~~~~~~~
198+
199+
200+
201+Anchors & Links
202+===============
203+
204+.. _reST anchor:
205+
206+Anchors
207+-------
208+
209+.. _ref role:
210+ https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-ref
211+
212+To refer a point in the documentation a anchor is needed. The :ref:`reST
213+template <reST template>` shows an example where a chapter titled *"Chapters"*
214+gets an anchor named ``chapter title``. Another example from *this* document,
215+where the anchor named ``reST anchor``:
216+
217+.. code:: reST
218+
219+ .. _reST anchor:
220+
221+ Anchors
222+ -------
223+
224+ To refer a point in the documentation a anchor is needed ...
225+
226+To refer anchors use the `ref role`_ markup:
227+
228+.. code:: reST
229+
230+ Visit chapter :ref:`reST anchor`. Or set hyperlink text manualy :ref:`foo
231+ bar <reST anchor>`.
232+
233+.. admonition:: ``:ref:`` role
234+ :class: rst-example
235+
236+ Visist chapter :ref:`reST anchor`. Or set hyperlink text manualy :ref:`foo
237+ bar <reST anchor>`.
238+
239+.. _reST ordinary ref:
240+
241+Link ordinary URL
242+-----------------
243+
244+If you need to reference external URLs use *named* hyperlinks to maintain
245+readability of reST sources. Here is a example taken from *this* article:
246+
247+.. code:: reST
248+
249+ .. _Sphinx Field Lists:
250+ https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html
251+
252+ With the *named* hyperlink `Sphinx Field Lists`_, the raw text is much more
253+ readable.
254+
255+ And this shows the alternative (less readable) hyperlink markup `Sphinx Field
256+ Lists
257+ <https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html>`__.
258+
259+.. admonition:: Named hyperlink
260+ :class: rst-example
261+
262+ With the *named* hyperlink `Sphinx Field Lists`_, the raw text is much more
263+ readable.
264+
265+ And this shows the alternative (less readable) hyperlink markup `Sphinx Field
266+ Lists
267+ <https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html>`__.
268+
269+
270+.. _reST smart ref:
271+
272+Smart refs
273+----------
274+
275+With the power of sphinx.ext.extlinks_ and intersphinx_ referencing external
276+content becomes smart.
277+
278+.. table:: smart refs with sphinx.ext.extlinks_ and intersphinx_
279+ :widths: 4 3 7
280+
281+ ========================== ================================== ====================================
282+ refer ... rendered example markup
283+ ========================== ================================== ====================================
284+ :rst:role:`rfc` :rfc:`822` ``:rfc:`822```
285+ :rst:role:`pep` :pep:`8` ``:pep:`8```
286+ sphinx.ext.extlinks_
287+ --------------------------------------------------------------------------------------------------
288+ project's wiki article :wiki:`Offline-engines` ``:wiki:`Offline-engines```
289+ to docs public URL :docs:`dev/reST.html` ``:docs:`dev/reST.html```
290+ files & folders origin :origin:`docs/dev/reST.rst` ``:origin:`docs/dev/reST.rst```
291+ pull request :pull:`1756` ``:pull:`1756```
292+ patch :patch:`af2cae6` ``:patch:`af2cae6```
293+ PyPi package :pypi:`searx` ``:pypi:`searx```
294+ manual page man :man:`bash` ``:man:`bash```
295+ intersphinx_
296+ --------------------------------------------------------------------------------------------------
297+ external anchor :ref:`python:and` ``:ref:`python:and```
298+ external doc anchor :doc:`jinja:templates` ``:doc:`jinja:templates```
299+ python code object :py:obj:`datetime.datetime` ``:py:obj:`datetime.datetime```
300+ flask code object :py:obj:`flask.Flask` ``:py:obj:`flask.Flask```
301+ ========================== ================================== ====================================
302+
303+
304+Intersphinx is configured in :origin:`docs/conf.py`:
305+
306+.. code:: python
307+
308+ intersphinx_mapping = {
309+ "python": ("https://docs.python.org/3/", None),
310+ "flask": ("https://flask.palletsprojects.com/", None),
311+ "jinja": ("https://jinja.palletsprojects.com/", None),
312+ "linuxdoc" : ("https://return42.github.io/linuxdoc/", None),
313+ "sphinx" : ("https://www.sphinx-doc.org/en/master/", None),
314+ }
315+
316+
317+To list all anchors of the inventory (e.g. ``python``) use:
318+
319+.. code:: sh
320+
321+ $ python -m sphinx.ext.intersphinx https://docs.python.org/3/objects.inv
322+
323+Literal blocks
324+==============
325+
326+The simplest form of :duref:`literal-blocks` is a indented block introduced by
327+two colons (``::``). For highlighting use :dudir:`highlight` or :ref:`reST
328+code` directive. To include literals from external files use directive
329+:dudir:`literalinclude`.
330+
331+.. _reST literal:
332+
333+``::``
334+------
335+
336+.. code:: reST
337+
338+ ::
339+
340+ Literal block
341+
342+ Lorem ipsum dolor::
343+
344+ Literal block
345+
346+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
347+ eirmod tempor invidunt ut labore ::
348+
349+ Literal block
350+
351+.. admonition:: Literal block
352+ :class: rst-example
353+
354+ ::
355+
356+ Literal block
357+
358+ Lorem ipsum dolor::
359+
360+ Literal block
361+
362+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
363+ eirmod tempor invidunt ut labore ::
364+
365+ Literal block
366+
367+
368+.. _reST code:
369+
370+``code-block``
371+--------------
372+
373+.. _pygments: https://pygments.org/languages/
374+
375+.. sidebar:: Syntax highlighting
376+
377+ is handled by pygments_.
378+
379+The :rst:dir:`code-block` directive is a variant of the :dudir:`code` directive
380+with additional options. To learn more about code literals visit
381+:ref:`sphinx:code-examples`.
382+
383+.. code-block:: reST
384+
385+ The URL ``/stats`` handle is shown in :ref:`stats-handle`
386+
387+ .. code-block:: Python
388+ :caption: python code block
389+ :name: stats-handle
390+
391+ @app.route('/stats', methods=['GET'])
392+ def stats():
393+ """Render engine statistics page."""
394+ stats = get_engines_stats()
395+ return render(
396+ 'stats.html'
397+ , stats = stats )
398+
399+.. code-block:: reST
400+
401+.. admonition:: Code block
402+ :class: rst-example
403+
404+ The URL ``/stats`` handle is shown in :ref:`stats-handle`
405+
406+ .. code-block:: Python
407+ :caption: python code block
408+ :name: stats-handle
409+
410+ @app.route('/stats', methods=['GET'])
411+ def stats():
412+ """Render engine statistics page."""
413+ stats = get_engines_stats()
414+ return render(
415+ 'stats.html'
416+ , stats = stats )
417+
418+Unicode substitution
419+====================
420+
421+The :dudir:`unicode directive <unicode-character-codes>` converts Unicode
422+character codes (numerical values) to characters. This directive can only be
423+used within a substitution definition.
424+
425+.. code-block:: reST
426+
427+ .. |copy| unicode:: 0xA9 .. copyright sign
428+ .. |(TM)| unicode:: U+2122
429+
430+ Trademark |(TM)| and copyright |copy| glyphs.
431+
432+.. admonition:: Unicode
433+ :class: rst-example
434+
435+ .. |copy| unicode:: 0xA9 .. copyright sign
436+ .. |(TM)| unicode:: U+2122
437+
438+ Trademark |(TM)| and copyright |copy| glyphs.
439+
440+
441+.. _reST roles:
442+
443+Roles
444+=====
445+
446+.. sidebar:: Further reading
447+
448+ - `Sphinx Roles`_
449+ - :doc:`sphinx:usage/restructuredtext/domains`
450+
451+
452+A *custom interpreted text role* (:duref:`ref <roles>`) is an inline piece of
453+explicit markup. It signifies that that the enclosed text should be interpreted
454+in a specific way.
455+
456+The general markup is one of:
457+
458+.. code:: reST
459+
460+ :rolename:`ref-name`
461+ :rolename:`ref text <ref-name>`
462+
463+.. table:: smart refs with sphinx.ext.extlinks_ and intersphinx_
464+ :widths: 4 3 7
465+
466+ ========================== ================================== ====================================
467+ role rendered example markup
468+ ========================== ================================== ====================================
469+ :rst:role:`guilabel` :guilabel:`&Cancel` ``:guilabel:`&Cancel```
470+ :rst:role:`kbd` :kbd:`C-x C-f` ``:kbd:`C-x C-f```
471+ :rst:role:`menuselection` :menuselection:`Open --> File` ``:menuselection:`Open --> File```
472+ :rst:role:`download` :download:`this file <reST.rst>` ``:download:`this file <reST.rst>```
473+ math_ :math:`a^2 + b^2 = c^2` ``:math:`a^2 + b^2 = c^2```
474+ :rst:role:`ref` :ref:`svg image example` ``:ref:`svg image example```
475+ :rst:role:`command` :command:`ls -la` ``:command:`ls -la```
476+ :durole:`emphasis` :emphasis:`italic` ``:emphasis:`italic```
477+ :durole:`strong` :strong:`bold` ``:strong:`bold```
478+ :durole:`literal` :literal:`foo()` ``:literal:`foo()```
479+ :durole:`subscript` H\ :sub:`2`\ O ``H\ :sub:`2`\ O``
480+ :durole:`superscript` E = mc\ :sup:`2` ``E = mc\ :sup:`2```
481+ :durole:`title-reference` :title:`Time` ``:title:`Time```
482+ ========================== ================================== ====================================
483+
484+Figures & Images
485+================
486+
487+.. sidebar:: Image processing
488+
489+ With the directives from :ref:`linuxdoc <linuxdoc:kfigure>` the build process
490+ is flexible. To get best results in the generated output format, install
491+ ImageMagick_ and Graphviz_.
492+
493+Searx's sphinx setup includes: :ref:`linuxdoc:kfigure`. Scaleable here means;
494+scaleable in sense of the build process. Normally in absence of a converter
495+tool, the build process will break. From the authors POV it’s annoying to care
496+about the build process when handling with images, especially since he has no
497+access to the build process. With :ref:`linuxdoc:kfigure` the build process
498+continues and scales output quality in dependence of installed image processors.
499+
500+If you want to add an image, you should use the ``kernel-figure`` (inheritance
501+of :dudir:`figure`) and ``kernel-image`` (inheritance of :dudir:`image`)
502+directives. E.g. to insert a figure with a scaleable image format use SVG
503+(:ref:`svg image example`):
504+
505+.. code:: reST
506+
507+ .. _svg image example:
508+
509+ .. kernel-figure:: svg_image.svg
510+ :alt: SVG image example
511+
512+ Simple SVG image
513+
514+ To refer the figure, a caption block is needed: :ref:`svg image example`.
515+
516+.. _svg image example:
517+
518+.. kernel-figure:: svg_image.svg
519+ :alt: SVG image example
520+
521+ Simple SVG image.
522+
523+To refer the figure, a caption block is needed: :ref:`svg image example`.
524+
525+DOT files (aka Graphviz)
526+------------------------
527+
528+With :ref:`linuxdoc:kernel-figure` reST support for **DOT** formatted files is
529+given.
530+
531+- `Graphviz's dot`_
532+- DOT_
533+- Graphviz_
534+
535+A simple example is shown in :ref:`dot file example`:
536+
537+.. code:: reST
538+
539+ .. _dot file example:
540+
541+ .. kernel-figure:: hello.dot
542+ :alt: hello world
543+
544+ DOT's hello world example
545+
546+.. admonition:: hello.dot
547+ :class: rst-example
548+
549+ .. _dot file example:
550+
551+ .. kernel-figure:: hello.dot
552+ :alt: hello world
553+
554+ DOT's hello world example
555+
556+``kernel-render`` DOT
557+---------------------
558+
559+Embed *render* markups (or languages) like Graphviz's **DOT** is provided by the
560+:ref:`linuxdoc:kernel-render` directive. A simple example of embedded DOT_ is
561+shown in figure :ref:`dot render example`:
562+
563+.. code:: reST
564+
565+ .. _dot render example:
566+
567+ .. kernel-render:: DOT
568+ :alt: digraph
569+ :caption: Embedded DOT (Graphviz) code
570+
571+ digraph foo {
572+ "bar" -> "baz";
573+ }
574+
575+ Attribute ``caption`` is needed, if you want to refer the figure: :ref:`dot
576+ render example`.
577+
578+Please note :ref:`build tools <linuxdoc:kfigure_build_tools>`. If Graphviz_ is
579+installed, you will see an vector image. If not, the raw markup is inserted as
580+*literal-block*.
581+
582+.. admonition:: kernel-render DOT
583+ :class: rst-example
584+
585+ .. _dot render example:
586+
587+ .. kernel-render:: DOT
588+ :alt: digraph
589+ :caption: Embedded DOT (Graphviz) code
590+
591+ digraph foo {
592+ "bar" -> "baz";
593+ }
594+
595+ Attribute ``caption`` is needed, if you want to refer the figure: :ref:`dot
596+ render example`.
597+
598+``kernel-render`` SVG
599+---------------------
600+
601+A simple example of embedded SVG_ is shown in figure :ref:`svg render example`:
602+
603+.. code:: reST
604+
605+ .. _svg render example:
606+
607+ .. kernel-render:: SVG
608+ :caption: Embedded **SVG** markup
609+ :alt: so-nw-arrow
610+..
611+
612+ .. code:: xml
613+
614+ <?xml version="1.0" encoding="UTF-8"?>
615+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
616+ baseProfile="full" width="70px" height="40px"
617+ viewBox="0 0 700 400"
618+ >
619+ <line x1="180" y1="370"
620+ x2="500" y2="50"
621+ stroke="black" stroke-width="15px"
622+ />
623+ <polygon points="585 0 525 25 585 50"
624+ transform="rotate(135 525 25)"
625+ />
626+ </svg>
627+
628+.. admonition:: kernel-render SVG
629+ :class: rst-example
630+
631+ .. _svg render example:
632+
633+ .. kernel-render:: SVG
634+ :caption: Embedded **SVG** markup
635+ :alt: so-nw-arrow
636+
637+ <?xml version="1.0" encoding="UTF-8"?>
638+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
639+ baseProfile="full" width="70px" height="40px"
640+ viewBox="0 0 700 400"
641+ >
642+ <line x1="180" y1="370"
643+ x2="500" y2="50"
644+ stroke="black" stroke-width="15px"
645+ />
646+ <polygon points="585 0 525 25 585 50"
647+ transform="rotate(135 525 25)"
648+ />
649+ </svg>
650+
651+
652+
653+
654+.. _reST lists:
655+
656+List markups
657+============
658+
659+Bullet list
660+-----------
661+
662+List markup (:duref:`ref <bullet-lists>`) is simple:
663+
664+.. code:: reST
665+
666+ - This is a bulleted list.
667+
668+ 1. Nested lists are possible, but be aware that they must be separated from
669+ the parent list items by blank line
670+ 2. Second item of nested list
671+
672+ - It has two items, the second
673+ item uses two lines.
674+
675+ #. This is a numbered list.
676+ #. It has two items too.
677+
678+.. admonition:: bullet list
679+ :class: rst-example
680+
681+ - This is a bulleted list.
682+
683+ 1. Nested lists are possible, but be aware that they must be separated from
684+ the parent list items by blank line
685+ 2. Second item of nested list
686+
687+ - It has two items, the second
688+ item uses two lines.
689+
690+ #. This is a numbered list.
691+ #. It has two items too.
692+
693+
694+Horizontal list
695+---------------
696+
697+The :rst:dir:`.. hlist:: <hlist>` transforms a bullet list into a more compact
698+list.
699+
700+.. code:: reST
701+
702+ .. hlist::
703+
704+ - first list item
705+ - second list item
706+ - third list item
707+ ...
708+
709+.. admonition:: hlist
710+ :class: rst-example
711+
712+ .. hlist::
713+
714+ - first list item
715+ - second list item
716+ - third list item
717+ - next list item
718+ - next list item xxxx
719+ - next list item yyyy
720+ - next list item zzzz
721+
722+
723+Definition list
724+---------------
725+
726+.. sidebar:: Note ..
727+
728+ - the term cannot have more than one line of text
729+
730+ - there is **no blank line between term and definition block** // this
731+ distinguishes definition lists (:duref:`ref <definition-lists>`) from block
732+ quotes (:duref:`ref <block-quotes>`).
733+
734+Each definition list (:duref:`ref <definition-lists>`) item contains a term,
735+optional classifiers and a definition. A term is a simple one-line word or
736+phrase. Optional classifiers may follow the term on the same line, each after
737+an inline ' : ' (**space, colon, space**). A definition is a block indented
738+relative to the term, and may contain multiple paragraphs and other body
739+elements. There may be no blank line between a term line and a definition block
740+(*this distinguishes definition lists from block quotes*). Blank lines are
741+required before the first and after the last definition list item, but are
742+optional in-between.
743+
744+Definition lists are created as follows:
745+
746+.. code:: reST
747+
748+ term 1 (up to a line of text)
749+ Definition 1.
750+
751+ See the typo : this line is not a term!
752+
753+ And this is not term's definition. **There is a blank line** in between
754+ the line above and this paragraph. That's why this paragraph is taken as
755+ **block quote** (:duref:`ref <block-quotes>`) and not as term's definition!
756+
757+ term 2
758+ Definition 2, paragraph 1.
759+
760+ Definition 2, paragraph 2.
761+
762+ term 3 : classifier
763+ Definition 3.
764+
765+ term 4 : classifier one : classifier two
766+ Definition 4.
767+
768+.. admonition:: definition list
769+ :class: rst-example
770+
771+ term 1 (up to a line of text)
772+ Definition 1.
773+
774+ See the typo : this line is not a term!
775+
776+ And this is not term's definition. **There is a blank line** in between
777+ the line above and this paragraph. That's why this paragraph is taken as
778+ **block quote** (:duref:`ref <block-quotes>`) and not as term's definition!
779+
780+
781+ term 2
782+ Definition 2, paragraph 1.
783+
784+ Definition 2, paragraph 2.
785+
786+ term 3 : classifier
787+ Definition 3.
788+
789+ term 4 : classifier one : classifier two
790+
791+
792+Quoted paragraphs
793+-----------------
794+
795+Quoted paragraphs (:duref:`ref <block-quotes>`) are created by just indenting
796+them more than the surrounding paragraphs. Line blocks (:duref:`ref
797+<line-blocks>`) are a way of preserving line breaks:
798+
799+.. code:: reST
800+
801+ normal paragraph ...
802+ lorem ipsum.
803+
804+ Quoted paragraph ...
805+ lorem ipsum.
806+
807+ | These lines are
808+ | broken exactly like in
809+ | the source file.
810+
811+
812+.. admonition:: Quoted paragraph and line block
813+ :class: rst-example
814+
815+ normal paragraph ...
816+ lorem ipsum.
817+
818+ Quoted paragraph ...
819+ lorem ipsum.
820+
821+ | These lines are
822+ | broken exactly like in
823+ | the source file.
824+
825+
826+.. _reST field list:
827+
828+Field Lists
829+-----------
830+
831+.. _Sphinx Field Lists:
832+ https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html
833+
834+.. sidebar:: bibliographic fields
835+
836+ First lines fields are bibliographic fields, see `Sphinx Field Lists`_.
837+
838+Field lists are used as part of an extension syntax, such as options for
839+directives, or database-like records meant for further processing. Field lists
840+are mappings from field names to field bodies. They marked up like this:
841+
842+.. code:: reST
843+
844+ :fieldname: Field content
845+ :foo: first paragraph in field foo
846+
847+ second paragraph in field foo
848+
849+ :bar: Field content
850+
851+.. admonition:: Field List
852+ :class: rst-example
853+
854+ :fieldname: Field content
855+ :foo: first paragraph in field foo
856+
857+ second paragraph in field foo
858+
859+ :bar: Field content
860+
861+
862+They are commonly used in Python documentation:
863+
864+.. code:: python
865+
866+ def my_function(my_arg, my_other_arg):
867+ """A function just for me.
868+
869+ :param my_arg: The first of my arguments.
870+ :param my_other_arg: The second of my arguments.
871+
872+ :returns: A message (just for me, of course).
873+ """
874+
875+Further list blocks
876+-------------------
877+
878+- field lists (:duref:`ref <field-lists>`, with caveats noted in
879+ :ref:`reST field list`)
880+- option lists (:duref:`ref <option-lists>`)
881+- quoted literal blocks (:duref:`ref <quoted-literal-blocks>`)
882+- doctest blocks (:duref:`ref <doctest-blocks>`)
883+
884+
885+Admonitions
886+===========
887+
888+Sidebar
889+-------
890+
891+Sidebar is an eye catcher, often used for admonitions pointing further stuff or
892+site effects. Here is the source of the sidebar :ref:`on top of this page <reST
893+primer>`.
894+
895+.. code:: reST
896+
897+ .. sidebar:: KISS_ and readability_
898+
899+ Instead of defining more and more roles, we at searx encourage our
900+ contributors to follow principles like KISS_ and readability_.
901+
902+Generic admonition
903+------------------
904+
905+The generic :dudir:`admonition <admonitions>` needs a title:
906+
907+.. code:: reST
908+
909+ .. admonition:: generic admonition title
910+
911+ lorem ipsum ..
912+
913+
914+.. admonition:: generic admonition title
915+
916+ lorem ipsum ..
917+
918+
919+Specific admonitions
920+--------------------
921+
922+Specific admonitions: :dudir:`hint`, :dudir:`note`, :dudir:`tip` :dudir:`attention`,
923+:dudir:`caution`, :dudir:`danger`, :dudir:`error`, , :dudir:`important`, and
924+:dudir:`warning` .
925+
926+.. code:: reST
927+
928+ .. hint::
929+
930+ lorem ipsum ..
931+
932+ .. note::
933+
934+ lorem ipsum ..
935+
936+ .. warning::
937+
938+ lorem ipsum ..
939+
940+
941+.. hint::
942+
943+ lorem ipsum ..
944+
945+.. note::
946+
947+ lorem ipsum ..
948+
949+.. tip::
950+
951+ lorem ipsum ..
952+
953+.. attention::
954+
955+ lorem ipsum ..
956+
957+.. caution::
958+
959+ lorem ipsum ..
960+
961+.. danger::
962+
963+ lorem ipsum ..
964+
965+.. important::
966+
967+ lorem ipsum ..
968+
969+.. error::
970+
971+ lorem ipsum ..
972+
973+.. warning::
974+
975+ lorem ipsum ..
976+
977+
978+Tables
979+======
980+
981+.. sidebar:: Nested tables
982+
983+ Nested tables are ugly! Not all builder support nested tables, don't use
984+ them!
985+
986+ASCII-art tables like :ref:`reST simple table` and :ref:`reST grid table` might
987+be comfortable for readers of the text-files, but they have huge disadvantages
988+in the creation and modifying. First, they are hard to edit. Think about
989+adding a row or a column to a ASCII-art table or adding a paragraph in a cell,
990+it is a nightmare on big tables.
991+
992+
993+.. sidebar:: List tables
994+
995+ For meaningful patch and diff use :ref:`reST flat table`.
996+
997+Second the diff of modifying ASCII-art tables is not meaningful, e.g. widening a
998+cell generates a diff in which also changes are included, which are only
999+ascribable to the ASCII-art. Anyway, if you prefer ASCII-art for any reason,
1000+here are some helpers:
1001+
1002+* `Emacs Table Mode`_
1003+* `Online Tables Generator`_
1004+
1005+.. _reST simple table:
1006+
1007+Simple tables
1008+-------------
1009+
1010+:duref:`Simple tables <simple-tables>` allow *colspan* but not *rowspan*. If
1011+your table need some metadata (e.g. a title) you need to add the ``.. table::
1012+directive`` :dudir:`(ref) <table>` in front and place the table in its body:
1013+
1014+.. code:: reST
1015+
1016+ .. table:: foo gate truth table
1017+ :widths: grid
1018+ :align: left
1019+
1020+ ====== ====== ======
1021+ Inputs Output
1022+ ------------- ------
1023+ A B A or B
1024+ ====== ====== ======
1025+ False
1026+ --------------------
1027+ True
1028+ --------------------
1029+ True False True
1030+ (foo)
1031+ ------ ------ ------
1032+ False True
1033+ (foo)
1034+ ====== =============
1035+
1036+.. admonition:: Simple ASCII table
1037+ :class: rst-example
1038+
1039+ .. table:: foo gate truth table
1040+ :widths: grid
1041+ :align: left
1042+
1043+ ====== ====== ======
1044+ Inputs Output
1045+ ------------- ------
1046+ A B A or B
1047+ ====== ====== ======
1048+ False
1049+ --------------------
1050+ True
1051+ --------------------
1052+ True False True
1053+ (foo)
1054+ ------ ------ ------
1055+ False True
1056+ (foo)
1057+ ====== =============
1058+
1059+
1060+
1061+.. _reST grid table:
1062+
1063+Grid tables
1064+-----------
1065+
1066+:duref:`Grid tables <grid-tables>` allow colspan *colspan* and *rowspan*:
1067+
1068+.. code:: reST
1069+
1070+ .. table:: grid table example
1071+ :widths: 1 1 5
1072+
1073+ +------------+------------+-----------+
1074+ | Header 1 | Header 2 | Header 3 |
1075+ +============+============+===========+
1076+ | body row 1 | column 2 | column 3 |
1077+ +------------+------------+-----------+
1078+ | body row 2 | Cells may span columns.|
1079+ +------------+------------+-----------+
1080+ | body row 3 | Cells may | - Cells |
1081+ +------------+ span rows. | - contain |
1082+ | body row 4 | | - blocks. |
1083+ +------------+------------+-----------+
1084+
1085+.. admonition:: ASCII grid table
1086+ :class: rst-example
1087+
1088+ .. table:: grid table example
1089+ :widths: 1 1 5
1090+
1091+ +------------+------------+-----------+
1092+ | Header 1 | Header 2 | Header 3 |
1093+ +============+============+===========+
1094+ | body row 1 | column 2 | column 3 |
1095+ +------------+------------+-----------+
1096+ | body row 2 | Cells may span columns.|
1097+ +------------+------------+-----------+
1098+ | body row 3 | Cells may | - Cells |
1099+ +------------+ span rows. | - contain |
1100+ | body row 4 | | - blocks. |
1101+ +------------+------------+-----------+
1102+
1103+
1104+.. _reST flat table:
1105+
1106+flat-table
1107+----------
1108+
1109+The ``flat-table`` is a further developed variant of the :ref:`list tables
1110+<linuxdoc:list-table-directives>`. It is a double-stage list similar to the
1111+:dudir:`list-table` with some additional features:
1112+
1113+column-span: ``cspan``
1114+ with the role ``cspan`` a cell can be extended through additional columns
1115+
1116+row-span: ``rspan``
1117+ with the role ``rspan`` a cell can be extended through additional rows
1118+
1119+auto-span:
1120+ spans rightmost cell of a table row over the missing cells on the right side
1121+ of that table-row. With Option ``:fill-cells:`` this behavior can changed
1122+ from *auto span* to *auto fill*, which automatically inserts (empty) cells
1123+ instead of spanning the last cell.
1124+
1125+options:
1126+ :header-rows: [int] count of header rows
1127+ :stub-columns: [int] count of stub columns
1128+ :widths: [[int] [int] ... ] widths of columns
1129+ :fill-cells: instead of auto-span missing cells, insert missing cells
1130+
1131+roles:
1132+ :cspan: [int] additional columns (*morecols*)
1133+ :rspan: [int] additional rows (*morerows*)
1134+
1135+The example below shows how to use this markup. The first level of the staged
1136+list is the *table-row*. In the *table-row* there is only one markup allowed,
1137+the list of the cells in this *table-row*. Exception are *comments* ( ``..`` )
1138+and *targets* (e.g. a ref to :ref:`row 2 of table's body <row body 2>`).
1139+
1140+.. code:: reST
1141+
1142+ .. flat-table:: ``flat-table`` example
1143+ :header-rows: 2
1144+ :stub-columns: 1
1145+ :widths: 1 1 1 1 2
1146+
1147+ * - :rspan:`1` head / stub
1148+ - :cspan:`3` head 1.1-4
1149+
1150+ * - head 2.1
1151+ - head 2.2
1152+ - head 2.3
1153+ - head 2.4
1154+
1155+ * .. row body 1 / this is a comment
1156+
1157+ - row 1
1158+ - :rspan:`2` cell 1-3.1
1159+ - cell 1.2
1160+ - cell 1.3
1161+ - cell 1.4
1162+
1163+ * .. Comments and targets are allowed on *table-row* stage.
1164+ .. _`row body 2`:
1165+
1166+ - row 2
1167+ - cell 2.2
1168+ - :rspan:`1` :cspan:`1`
1169+ cell 2.3 with a span over
1170+
1171+ * col 3-4 &
1172+ * row 2-3
1173+
1174+ * - row 3
1175+ - cell 3.2
1176+
1177+ * - row 4
1178+ - cell 4.1
1179+ - cell 4.2
1180+ - cell 4.3
1181+ - cell 4.4
1182+
1183+ * - row 5
1184+ - cell 5.1 with automatic span to rigth end
1185+
1186+ * - row 6
1187+ - cell 6.1
1188+ - ..
1189+
1190+
1191+.. admonition:: List table
1192+ :class: rst-example
1193+
1194+ .. flat-table:: ``flat-table`` example
1195+ :header-rows: 2
1196+ :stub-columns: 1
1197+ :widths: 1 1 1 1 2
1198+
1199+ * - :rspan:`1` head / stub
1200+ - :cspan:`3` head 1.1-4
1201+
1202+ * - head 2.1
1203+ - head 2.2
1204+ - head 2.3
1205+ - head 2.4
1206+
1207+ * .. row body 1 / this is a comment
1208+
1209+ - row 1
1210+ - :rspan:`2` cell 1-3.1
1211+ - cell 1.2
1212+ - cell 1.3
1213+ - cell 1.4
1214+
1215+ * .. Comments and targets are allowed on *table-row* stage.
1216+ .. _`row body 2`:
1217+
1218+ - row 2
1219+ - cell 2.2
1220+ - :rspan:`1` :cspan:`1`
1221+ cell 2.3 with a span over
1222+
1223+ * col 3-4 &
1224+ * row 2-3
1225+
1226+ * - row 3
1227+ - cell 3.2
1228+
1229+ * - row 4
1230+ - cell 4.1
1231+ - cell 4.2
1232+ - cell 4.3
1233+ - cell 4.4
1234+
1235+ * - row 5
1236+ - cell 5.1 with automatic span to rigth end
1237+
1238+ * - row 6
1239+ - cell 6.1
1240+ - ..
1241+
1242+
1243+CSV table
1244+---------
1245+
1246+CSV table might be the choice if you want to include CSV-data from a outstanding
1247+(build) process into your documentation.
1248+
1249+.. code:: reST
1250+
1251+ .. csv-table:: CSV table example
1252+ :header: .. , Column 1, Column 2
1253+ :widths: 2 5 5
1254+ :stub-columns: 1
1255+ :file: csv_table.txt
1256+
1257+Content of file ``csv_table.txt``:
1258+
1259+.. literalinclude:: csv_table.txt
1260+
1261+.. admonition:: CSV table
1262+ :class: rst-example
1263+
1264+ .. csv-table:: CSV table example
1265+ :header: .. , Column 1, Column 2
1266+ :widths: 3 5 5
1267+ :stub-columns: 1
1268+ :file: csv_table.txt
1269+
1270+Templating
1271+==========
1272+
1273+.. sidebar:: Build environment
1274+
1275+ All *generic-doc* tasks are running in the :ref:`build environment <make
1276+ pyenv>`.
1277+
1278+Templating is suitable for documentation which is created generic at the build
1279+time. The sphinx-jinja_ extension evaluates jinja_ templates in the :ref:`build
1280+environment <make pyenv>` (with searx modules installed). We use this e.g. to
1281+build chapter: :ref:`engines generic`. Below the jinja directive from the
1282+:origin:`docs/admin/engines.rst` is shown:
1283+
1284+.. literalinclude:: ../admin/engines.rst
1285+ :language: reST
1286+ :start-after: .. _configured engines:
1287+
1288+The context for the template is selected in the line ``.. jinja:: webapp``. In
1289+sphinx's build configuration (:origin:`docs/conf.py`) the ``webapp`` context
1290+points to the name space of the python module: ``webapp``.
1291+
1292+.. code:: py
1293+
1294+ from searx import webapp
1295+ jinja_contexts = {
1296+ 'webapp': dict(**webapp.__dict__)
1297+ }
1298+
1299+
1300+Tabbed views
1301+============
1302+
1303+.. _sphinx-tabs: https://github.com/djungelorm/sphinx-tabs
1304+.. _basic-tabs: https://github.com/djungelorm/sphinx-tabs#basic-tabs
1305+.. _group-tabs: https://github.com/djungelorm/sphinx-tabs#group-tabs
1306+.. _code-tabs: https://github.com/djungelorm/sphinx-tabs#code-tabs
1307+
1308+With `sphinx-tabs`_ extension we have *tabbed views*. To provide installation
1309+instructions with one tab per distribution we use the `group-tabs`_ directive,
1310+others are basic-tabs_ and code-tabs_. Below a *group-tab* example from
1311+:ref:`docs build` is shown:
1312+
1313+.. literalinclude:: ../admin/buildhosts.rst
1314+ :language: reST
1315+ :start-after: .. _system requirements:
1316+ :end-before: .. _system requirements END:
1317+
1318+
1319+.. _math:
1320+
1321+Math equations
1322+==============
1323+
1324+.. _Mathematics: https://en.wikibooks.org/wiki/LaTeX/Mathematics
1325+.. _amsmath user guide:
1326+ http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/macros/latex/required/amsmath/amsldoc.pdf
1327+
1328+.. sidebar:: About LaTeX
1329+
1330+ - `amsmath user guide`_
1331+ - Mathematics_
1332+ - :ref:`docs build`
1333+
1334+The input language for mathematics is LaTeX markup using the :ctan:`amsmath`
1335+package.
1336+
1337+To embed LaTeX markup in reST documents, use role :rst:role:`:math: <math>` for
1338+inline and directive :rst:dir:`.. math:: <math>` for block markup.
1339+
1340+.. code:: reST
1341+
1342+ In :math:numref:`schroedinger general` the time-dependent Schrödinger equation
1343+ is shown.
1344+
1345+ .. math::
1346+ :label: schroedinger general
1347+
1348+ \mathrm{i}\hbar\dfrac{\partial}{\partial t} |\,\psi (t) \rangle =
1349+ \hat{H} |\,\psi (t) \rangle.
1350+
1351+.. admonition:: LaTeX math equation
1352+ :class: rst-example
1353+
1354+ In :math:numref:`schroedinger general` the time-dependent Schrödinger equation
1355+ is shown.
1356+
1357+ .. math::
1358+ :label: schroedinger general
1359+
1360+ \mathrm{i}\hbar\dfrac{\partial}{\partial t} |\,\psi (t) \rangle =
1361+ \hat{H} |\,\psi (t) \rangle.
1362+
1363+
1364+The next example shows the difference of ``\tfrac`` (*textstyle*) and ``\dfrac``
1365+(*displaystyle*) used in a inline markup or another fraction.
1366+
1367+.. code:: reST
1368+
1369+ ``\tfrac`` **inline example** :math:`\tfrac{\tfrac{1}{x}+\tfrac{1}{y}}{y-z}`
1370+ ``\dfrac`` **inline example** :math:`\dfrac{\dfrac{1}{x}+\dfrac{1}{y}}{y-z}`
1371+
1372+.. admonition:: Line spacing
1373+ :class: rst-example
1374+
1375+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
1376+ eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
1377+ voluptua. ...
1378+ ``\tfrac`` **inline example** :math:`\tfrac{\tfrac{1}{x}+\tfrac{1}{y}}{y-z}`
1379+ At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
1380+ gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
1381+
1382+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
1383+ eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
1384+ voluptua. ...
1385+ ``\tfrac`` **inline example** :math:`\dfrac{\dfrac{1}{x}+\dfrac{1}{y}}{y-z}`
1386+ At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
1387+ gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
1388+
1389+
1390+.. _KISS: https://en.wikipedia.org/wiki/KISS_principle
1391+
1392+.. _readability: https://docs.python-guide.org/writing/style/
1393+.. _Sphinx-Primer:
1394+ http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
1395+.. _reST: https://docutils.sourceforge.io/rst.html
1396+.. _Sphinx Roles:
1397+ https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html
1398+.. _Sphinx: http://www.sphinx-doc.org
1399+.. _`sphinx-doc FAQ`: http://www.sphinx-doc.org/en/stable/faq.html
1400+.. _Sphinx markup constructs:
1401+ http://www.sphinx-doc.org/en/stable/markup/index.html
1402+.. _`sphinx cross references`:
1403+ http://www.sphinx-doc.org/en/stable/markup/inline.html#cross-referencing-arbitrary-locations
1404+.. _sphinx.ext.extlinks:
1405+ https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
1406+.. _intersphinx: http://www.sphinx-doc.org/en/stable/ext/intersphinx.html
1407+.. _sphinx config: http://www.sphinx-doc.org/en/stable/config.html
1408+.. _Sphinx's autodoc: http://www.sphinx-doc.org/en/stable/ext/autodoc.html
1409+.. _Sphinx's Python domain:
1410+ http://www.sphinx-doc.org/en/stable/domains.html#the-python-domain
1411+.. _Sphinx's C domain:
1412+ http://www.sphinx-doc.org/en/stable/domains.html#cross-referencing-c-constructs
1413+.. _doctree:
1414+ http://www.sphinx-doc.org/en/master/extdev/tutorial.html?highlight=doctree#build-phases
1415+.. _docutils: http://docutils.sourceforge.net/docs/index.html
1416+.. _docutils FAQ: http://docutils.sourceforge.net/FAQ.html
1417+.. _linuxdoc: https://return42.github.io/linuxdoc
1418+.. _jinja: https://jinja.palletsprojects.com/
1419+.. _sphinx-jinja: https://github.com/tardyp/sphinx-jinja
1420+.. _SVG: https://www.w3.org/TR/SVG11/expanded-toc.html
1421+.. _DOT: https://graphviz.gitlab.io/_pages/doc/info/lang.html
1422+.. _`Graphviz's dot`: https://graphviz.gitlab.io/_pages/pdf/dotguide.pdf
1423+.. _Graphviz: https://graphviz.gitlab.io
1424+.. _ImageMagick: https://www.imagemagick.org
1425+
1426+.. _`Emacs Table Mode`: https://www.emacswiki.org/emacs/TableMode
1427+.. _`Online Tables Generator`: http://www.tablesgenerator.com/text_tables
1428+.. _`OASIS XML Exchange Table Model`: https://www.oasis-open.org/specs/tm9901.html
docs/dev/search_api.rstnew file+120
@@ -0,0 +1,120 @@
1+.. _search API:
2+
3+==========
4+Search API
5+==========
6+
7+The search supports both ``GET`` and ``POST``.
8+
9+Furthermore, two enpoints ``/`` and ``/search`` are available for querying.
10+
11+
12+``GET /``
13+
14+``GET /search``
15+
16+Parameters
17+==========
18+
19+.. sidebar:: Further reading ..
20+
21+ - :ref:`engines-dev`
22+ - :ref:`settings.yml`
23+ - :ref:`engines generic`
24+
25+``q`` : required
26+ The search query. This string is passed to external search services. Thus,
27+ searx supports syntax of each search service. For example, ``site:github.com
28+ searx`` is a valid query for Google. However, if simply the query above is
29+ passed to any search engine which does not filter its results based on this
30+ syntax, you might not get the results you wanted.
31+
32+ See more at :ref:`search-syntax`
33+
34+``categories`` : optional
35+ Comma separated list, specifies the active search categories
36+
37+``engines`` : optional
38+ Comma separated list, specifies the active search engines.
39+
40+``lang`` : default ``all``
41+ Code of the language.
42+
43+``pageno`` : default ``1``
44+ Search page number.
45+
46+``time_range`` : optional
47+ [ ``day``, ``month``, ``year`` ]
48+
49+ Time range of search for engines which support it. See if an engine supports
50+ time range search in the preferences page of an instance.
51+
52+``format`` : optional
53+ [ ``json``, ``csv``, ``rss`` ]
54+
55+ Output format of results.
56+
57+``results_on_new_tab`` : default ``0``
58+ [ ``0``, ``1`` ]
59+
60+ Open search results on new tab.
61+
62+``image_proxy`` : default ``False``
63+ [ ``True``, ``False`` ]
64+
65+ Proxy image results through searx.
66+
67+``autocomplete`` : default *empty*
68+ [ ``google``, ``dbpedia``, ``duckduckgo``, ``startpage``, ``wikipedia`` ]
69+
70+ Service which completes words as you type.
71+
72+``safesearch`` : default ``None``
73+ [ ``0``, ``1``, ``None`` ]
74+
75+ Filter search results of engines which support safe search. See if an engine
76+ supports safe search in the preferences page of an instance.
77+
78+``theme`` : default ``oscar``
79+ [ ``oscar``, ``simple``, ``legacy``, ``pix-art``, ``courgette`` ]
80+
81+ Theme of instance.
82+
83+ Please note, available themes depend on an instance. It is possible that an
84+ instance administrator deleted, created or renamed themes on his/her instance.
85+ See the available options in the preferences page of the instance.
86+
87+``oscar-style`` : default ``logicodev``
88+ [ ``pointhi``, ``logicodev`` ]
89+
90+ Style of Oscar theme. It is only parsed if the theme of an instance is
91+ ``oscar``.
92+
93+ Please note, available styles depend on an instance. It is possible that an
94+ instance administrator deleted, created or renamed styles on his/her
95+ instance. See the available options in the preferences page of the instance.
96+
97+``enabled_plugins`` : optional
98+ List of enabled plugins.
99+
100+ :default: ``HTTPS_rewrite``, ``Self_Informations``,
101+ ``Search_on_category_select``, ``Tracker_URL_remover``
102+
103+ :values: [ ``DOAI_rewrite``, ``HTTPS_rewrite``, ``Infinite_scroll``,
104+ ``Vim-like_hotkeys``, ``Self_Informations``, ``Tracker_URL_remover``,
105+ ``Search_on_category_select`` ]
106+
107+``disabled_plugins``: optional
108+ List of disabled plugins.
109+
110+ :default: ``DOAI_rewrite``, ``Infinite_scroll``, ``Vim-like_hotkeys``
111+ :values: ``DOAI_rewrite``, ``HTTPS_rewrite``, ``Infinite_scroll``,
112+ ``Vim-like_hotkeys``, ``Self_Informations``, ``Tracker_URL_remover``,
113+ ``Search_on_category_select``
114+
115+``enabled_engines`` : optional : *all* :origin:`engines <searx/engines>`
116+ List of enabled engines.
117+
118+``disabled_engines`` : optional : *all* :origin:`engines <searx/engines>`
119+ List of disabled engines.
120+
docs/dev/svg_image.svgnew file+10
@@ -0,0 +1,10 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<!-- originate: https://commons.wikimedia.org/wiki/File:Variable_Resistor.svg -->
3+<svg xmlns="http://www.w3.org/2000/svg"
4+ version="1.1" baseProfile="full"
5+ width="70px" height="40px" viewBox="0 0 700 400">
6+ <line x1="0" y1="200" x2="700" y2="200" stroke="black" stroke-width="20px"/>
7+ <rect x="100" y="100" width="500" height="200" fill="white" stroke="black" stroke-width="20px"/>
8+ <line x1="180" y1="370" x2="500" y2="50" stroke="black" stroke-width="15px"/>
9+ <polygon points="585 0 525 25 585 50" transform="rotate(135 525 25)"/>
10+</svg>
docs/dev/translation.rstnew file+71
@@ -0,0 +1,71 @@
1+.. _translation:
2+
3+===========
4+Translation
5+===========
6+
7+.. _searx@transifex: https://www.transifex.com/asciimoo/searx/
8+
9+Translation currently takes place on `searx@transifex`_
10+
11+Requirements
12+============
13+
14+* Transifex account
15+* Installed CLI tool of Transifex
16+
17+Init Transifex project
18+======================
19+
20+After installing ``transifex`` using pip, run the following command to
21+initialize the project.
22+
23+.. code:: sh
24+
25+ tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
26+
27+
28+After ``$HOME/.transifexrc`` is created, get a Transifex API key and insert it
29+into the configuration file.
30+
31+Create a configuration file for ``tx`` named ``$HOME/.tx/config``.
32+
33+.. code:: ini
34+
35+ [main]
36+ host = https://www.transifex.com
37+ [searx.messagespo]
38+ file_filter = searx/translations/<lang>/LC_MESSAGES/messages.po
39+ source_file = messages.pot
40+ source_lang = en
41+ type = PO
42+
43+
44+Then run ``tx set``:
45+
46+.. code:: shell
47+
48+ tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
49+ --source-lang en --type PO --source-file messages.pot --execute
50+
51+
52+Update translations
53+===================
54+
55+To retrieve the latest translations, pull it from Transifex.
56+
57+.. code:: sh
58+
59+ tx pull -a
60+
61+Then check the new languages. If strings translated are not enough, delete those
62+folders, because those should not be compiled. Call the command below to compile
63+the ``.po`` files.
64+
65+.. code:: shell
66+
67+ pybabel compile -d searx/translations
68+
69+
70+After the compilation is finished commit the ``.po`` and ``.mo`` files and
71+create a PR.
docs/index.rstnew file+34
@@ -0,0 +1,34 @@
1+================
2+Welcome to searx
3+================
4+
5+Search without being tracked.
6+
7+.. sidebar:: Features
8+
9+ - Self hosted
10+ - No user tracking
11+ - No user profiling
12+ - About 70 supported search engines
13+ - Easy integration with any search engine
14+ - Cookies are not used by default
15+ - Secure, encrypted connections (HTTPS/SSL)
16+ - Hosted by organizations, such as *La Quadrature du Net*, which promote
17+ digital rights
18+
19+Searx is a free internet metasearch engine which aggregates results from more
20+than 70 search services. Users are neither tracked nor profiled. Additionally,
21+searx can be used over Tor for online anonymity.
22+
23+Get started with searx by using one of the Searx-instances_. If you don't trust
24+anyone, you can set up your own, see :ref:`installation`.
25+
26+.. toctree::
27+ :maxdepth: 2
28+
29+ user/index
30+ admin/index
31+ dev/index
32+ blog/index
33+
34+.. _Searx-instances: https://searx.space
docs/static/img/searx_logo_small.pngnew file

Binary file not shown.

docs/user/index.rstnew file+9
@@ -0,0 +1,9 @@
1+==================
2+User documentation
3+==================
4+
5+.. toctree::
6+ :maxdepth: 1
7+
8+ search_syntax
9+ own-instance
docs/user/own-instance.rstnew file+77
@@ -0,0 +1,77 @@
1+===========================
2+Why use a private instance?
3+===========================
4+
5+"Is it worth to run my own instance?" is a common question among searx users.
6+Before answering this question, see what options a searx user has.
7+
8+Public instances are open to everyone who has access to its URL. Usually, these
9+are operated by unknown parties (from the users' point of view). Private
10+instances can be used by a select group of people. It is for example a searx of
11+group of friends or a company which can be accessed through VPN. Also it can be
12+single user one which runs on the user's laptop.
13+
14+To gain more insight on how these instances work let's dive into how searx
15+protects its users.
16+
17+How does searx protect privacy?
18+===============================
19+
20+Searx protects the privacy of its users in multiple ways regardless of the type
21+of the instance (private, public). Removal of private data from search requests
22+comes in three forms:
23+
24+ 1. removal of private data from requests going to search services
25+ 2. not forwarding anything from a third party services through search services
26+ (e.g. advertisement)
27+ 3. removal of private data from requests going to the result pages
28+
29+Removing private data means not sending cookies to external search engines and
30+generating a random browser profile for every request. Thus, it does not matter
31+if a public or private instance handles the request, because it is anonymized in
32+both cases. IP addresses will be the IP of the instance. But searx can be
33+configured to use proxy or Tor. `Result proxy
34+<https://github.com/asciimoo/morty>`__ is supported, too.
35+
36+Searx does not serve ads or tracking content unlike most search services. So
37+private data is not forwarded to third parties who might monetize it. Besides
38+protecting users from search services, both referring page and search query are
39+hidden from visited result pages.
40+
41+
42+What are the consequences of using public instances?
43+----------------------------------------------------
44+
45+If someone uses a public instance, he/she has to trust the administrator of that
46+instance. This means that the user of the public instance does not know whether
47+his/her requests are logged, aggregated and sent or sold to a third party.
48+
49+Also, public instances without proper protection are more vulnerable to abusing
50+the search service, In this case the external service in exchange returns
51+CAPTCHAs or bans the IP of the instance. Thus, search requests return less
52+results.
53+
54+I see. What about private instances?
55+------------------------------------
56+
57+If users run their own instances, everything is in their control: the source
58+code, logging settings and private data. Unknown instance administrators do not
59+have to be trusted.
60+
61+Furthermore, as the default settings of their instance is editable, there is no
62+need to use cookies to tailor searx to their needs. So preferences will not be
63+reset to defaults when clearing browser cookies. As settings are stored on
64+their computer, it will not be accessible to others as long as their computer is
65+not compromised.
66+
67+Conclusion
68+==========
69+
70+Always use an instance which is operated by people you trust. The privacy
71+features of searx are available to users no matter what kind of instance they
72+use.
73+
74+If someone is on the go or just wants to try searx for the first time public
75+instances are the best choices. Additionally, public instance are making a
76+world a better place, because those who cannot or do not want to run an
77+instance, have access to a privacy respecting search service.
docs/user/public_instances.rstnew file+3
@@ -0,0 +1,3 @@
1+:orphan:
2+
3+This page page has been moved to `searx.space <https://searx.space/>`__
docs/user/search_syntax.rstnew file+42
@@ -0,0 +1,42 @@
1+
2+.. _search-syntax:
3+
4+=============
5+Search syntax
6+=============
7+
8+Searx allows you to modify the default categories, engines and search language
9+via the search query.
10+
11+Prefix ``!``
12+ to set Category/engine
13+
14+Prefix: ``:``
15+ to set language
16+
17+Prefix: ``?``
18+ to add engines and categories to the currently selected categories
19+
20+Abbrevations of the engines and languages are also accepted. Engine/category
21+modifiers are chainable and inclusive (e.g. with :search:`!it !ddg !wp qwer
22+<?q=%21it%20%21ddg%20%21wp%20qwer>` search in IT category **and** duckduckgo
23+**and** wikipedia for ``qwer``).
24+
25+See the :search:`/preferences page <preferences>` for the list of engines,
26+categories and languages.
27+
28+Examples
29+========
30+
31+Search in wikipedia for ``qwer``:
32+
33+- :search:`!wp qwer <?q=%21wp%20qwer>` or
34+- :search:`!wikipedia qwer :search:<?q=%21wikipedia%20qwer>`
35+
36+Image search:
37+
38+- :search:`!images Cthulhu <?q=%21images%20Cthulhu>`
39+
40+Custom language in wikipedia:
41+
42+- :search:`:hu !wp hackerspace <?q=%3Ahu%20%21wp%20hackerspace>`
manage.sh+14−86
@@ -12,6 +12,7 @@ PYTHONPATH="$BASE_DIR"
1212SEARX_DIR="$BASE_DIR/searx"
1313ACTION="$1"
1414
15+. "${BASE_DIR}/utils/brand.env"
1516
1617#
1718# Python
@@ -20,12 +21,12 @@ ACTION="$1"
2021update_packages() {
2122 pip install --upgrade pip
2223 pip install --upgrade setuptools
23− pip install -r "$BASE_DIR/requirements.txt"
24+ pip install -Ur "$BASE_DIR/requirements.txt"
2425}
2526
2627update_dev_packages() {
2728 update_packages
28− pip install -r "$BASE_DIR/requirements-dev.txt"
29+ pip install -Ur "$BASE_DIR/requirements-dev.txt"
2930}
3031
3132install_geckodriver() {
@@ -72,45 +73,6 @@ locales() {
7273 pybabel compile -d "$SEARX_DIR/translations"
7374}
7475
75−update_useragents() {
76− echo '[!] Updating user agent versions'
77− python utils/fetch_firefox_version.py
78−}
79−
80−pep8_check() {
81− echo '[!] Running pep8 check'
82− # ignored rules:
83− # E402 module level import not at top of file
84− # W503 line break before binary operator
85− pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" "$SEARX_DIR" "$BASE_DIR/tests"
86−}
87−
88−unit_tests() {
89− echo '[!] Running unit tests'
90− python -m nose2 -s "$BASE_DIR/tests/unit"
91−}
92−
93−py_test_coverage() {
94− echo '[!] Running python test coverage'
95− PYTHONPATH="`pwd`" python -m nose2 -C --log-capture --with-coverage --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" \
96− && coverage report \
97− && coverage html
98−}
99−
100−robot_tests() {
101− echo '[!] Running robot tests'
102− PYTHONPATH="`pwd`" python "$SEARX_DIR/testing.py" robot
103−}
104−
105−tests() {
106− set -e
107− pep8_check
108− unit_tests
109− install_geckodriver
110− robot_tests
111− set +e
112−}
113−
11476
11577#
11678# Web
@@ -137,36 +99,6 @@ npm_packages() {
13799 npm install
138100}
139101
140−build_style() {
141− npm_path_setup
142−
143− lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
144−}
145−
146−styles() {
147− npm_path_setup
148−
149− echo '[!] Building legacy style'
150− build_style themes/legacy/less/style.less themes/legacy/css/style.css
151− build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css
152− echo '[!] Building courgette style'
153− build_style themes/courgette/less/style.less themes/courgette/css/style.css
154− build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
155− echo '[!] Building pix-art style'
156− build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
157− echo '[!] Building bootstrap style'
158− build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
159−}
160−
161−grunt_build() {
162− npm_path_setup
163−
164− echo '[!] Grunt build : oscar theme'
165− grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
166− echo '[!] Grunt build : simple theme'
167− grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
168−}
169−
170102docker_build() {
171103 # Check if it is a git repository
172104 if [ ! -d .git ]; then
@@ -191,8 +123,9 @@ docker_build() {
191123 SEARX_GIT_VERSION=$(git describe --match "v[0-9]*\.[0-9]*\.[0-9]*" HEAD 2>/dev/null | awk -F'-' '{OFS="-"; $1=substr($1, 2); $3=substr($3, 2); print}')
192124
193125 # add the suffix "-dirty" if the repository has uncommited change
126+ # /!\ HACK for searx/searx: ignore searx/brand.py and utils/brand.env
194127 git update-index -q --refresh
195− if [ ! -z "$(git diff-index --name-only HEAD --)" ]; then
128+ if [ ! -z "$(git diff-index --name-only HEAD -- | grep -v 'searx/brand.py' | grep -v 'utils/brand.env')" ]; then
196129 SEARX_GIT_VERSION="${SEARX_GIT_VERSION}-dirty"
197130 fi
198131
@@ -213,18 +146,18 @@ docker_build() {
213146 fi
214147
215148 # define the docker image name
216− # /!\ HACK to get the user name /!\
217− GITHUB_USER=$(git remote get-url origin | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
149+ GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
218150 SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx"
219151
220152 # build Docker image
221153 echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
222154 sudo docker build \
155+ --build-arg GIT_URL="${GIT_URL}" \
223156 --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
224157 --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
225158 --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
226159 --build-arg LABEL_VCS_REF=$(git rev-parse HEAD) \
227− --build-arg LABEL_VCS_URL=$(git remote get-url origin) \
160+ --build-arg LABEL_VCS_URL="${GIT_URL}" \
228161 --build-arg TIMESTAMP_SETTINGS=$(git log -1 --format="%cd" --date=unix -- searx/settings.yml) \
229162 --build-arg TIMESTAMP_UWSGI=$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini) \
230163 -t ${SEARX_IMAGE_NAME}:latest -t ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION} .
@@ -253,22 +186,17 @@ Commands
253186 update_dev_packages - Check & update development and production dependency changes
254187 install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests)
255188 npm_packages - Download & install npm dependencies
256− update_useragents - Update useragents.json with the most recent versions of Firefox
257189
258190 Build
259191 -----
260192 locales - Compile locales
261− styles - Build less files
262− grunt_build - Build files for themes
263− docker_build - Build Docker image
264193
265− Tests
266− -----
267− unit_tests - Run unit tests
268− pep8_check - Pep8 validation
269− robot_tests - Run selenium tests
270− tests - Run all python tests (pep8, unit, robot_tests)
271− py_test_coverage - Unit test coverage
194+Environment:
195+ GIT_URL: ${GIT_URL}
196+ ISSUE_URL: ${ISSUE_URL}
197+ SEARX_URL: ${SEARX_URL}
198+ DOCS_URL: ${DOCS_URL}
199+ PUBLIC_INSTANCES: ${PUBLIC_INSTANCES}
272200"
273201}
274202
requirements-dev.txt+7
@@ -1,10 +1,17 @@
1+pallets-sphinx-themes
2+Sphinx
3+sphinx-issues
14mock==2.0.0
25nose2[coverage_plugin]
36cov-core==1.15.0
47pep8==1.7.0
8+pylint
59plone.testing==5.0.0
610splinter==0.11.0
711transifex-client==0.12.2
812unittest2==1.1.0
913zope.testrunner==4.5.1
1014selenium==3.141.0
15+linuxdoc @ git+http://github.com/return42/linuxdoc.git
16+sphinx-jinja
17+sphinx-tabs
requirements.txt+9−9
@@ -1,12 +1,12 @@
1−certifi==2019.3.9
1+certifi==2020.4.5.1
22babel==2.7.0
3−flask-babel==0.12.2
4−flask==1.0.2
5−idna==2.8
6−jinja2==2.10.1
7−lxml==4.3.3
3+flask-babel==1.0.0
4+flask==1.1.2
5+idna==2.9
6+jinja2==2.11.1
7+lxml==4.5.0
88pygments==2.1.3
9−pyopenssl==19.0.0
9+pyopenssl==19.1.0
1010python-dateutil==2.8.0
11−pyyaml==5.1
12−requests[socks]==2.22.0
11+pyyaml==5.3.1
12+requests[socks]==2.23.0
searx/__init__.py+1
@@ -38,6 +38,7 @@ def check_settings_yml(file_name):
3838 else:
3939 return None
4040
41+
4142# find location of settings.yml
4243if 'SEARX_SETTINGS_PATH' in environ:
4344 # if possible set path to settings using the
searx/autocomplete.py+9
@@ -165,6 +165,14 @@ def startpage(query, lang):
165165 return []
166166
167167
168+def swisscows(query, lang):
169+ # swisscows autocompleter
170+ url = 'https://swisscows.ch/api/suggest?{query}&itemsCount=5'
171+
172+ resp = loads(get(url.format(query=urlencode({'query': query}))).text)
173+ return resp
174+
175+
168176def qwant(query, lang):
169177 # qwant autocompleter (additional parameter : lang=en_en&count=xxx )
170178 url = 'https://api.qwant.com/api/suggest?{query}'
@@ -196,6 +204,7 @@ backends = {'dbpedia': dbpedia,
196204 'duckduckgo': duckduckgo,
197205 'google': google,
198206 'startpage': startpage,
207+ 'swisscows': swisscows,
199208 'qwant': qwant,
200209 'wikipedia': wikipedia
201210 }
searx/brand.pynew file+5
@@ -0,0 +1,5 @@
1+GIT_URL = 'https://github.com/asciimoo/searx'
2+ISSUE_URL = 'https://github.com/asciimoo/searx/issues'
3+SEARX_URL = 'https://searx.me'
4+DOCS_URL = 'https://asciimoo.github.io/searx'
5+PUBLIC_INSTANCES = 'https://searx.space'
searx/data/engines_languages.json+28332−27487

This diff is too big to show here.

searx/data/useragents.json+5−8

This diff is too big to show here.

searx/engines/__init__.py+7−2

This diff is too big to show here.

searx/engines/bing.py+16−12

This diff is too big to show here.

searx/engines/bing_images.py+2−19

This diff is too big to show here.

searx/engines/bing_news.py+3−1

This diff is too big to show here.

searx/engines/bing_videos.py+5−1

This diff is too big to show here.

searx/engines/dummy-offline.pynew file+12

This diff is too big to show here.

searx/engines/etools.pynew file+54

This diff is too big to show here.

searx/engines/faroo.pydeleted−96

This diff is too big to show here.

searx/engines/flickr_noapi.py+17−9

This diff is too big to show here.

searx/engines/genius.py+1

This diff is too big to show here.

searx/engines/gigablast.py+28−13

This diff is too big to show here.

searx/engines/google_news.py+1−1

This diff is too big to show here.

searx/engines/ina.py+6−3

This diff is too big to show here.

searx/engines/microsoft_academic.py+2

This diff is too big to show here.

searx/engines/openstreetmap.py+1−1

This diff is too big to show here.

searx/engines/qwant.py+1

This diff is too big to show here.

searx/engines/scanr_structures.py+1−1

This diff is too big to show here.

searx/engines/spotify.py+14

This diff is too big to show here.

searx/engines/startpage.py+5−2

This diff is too big to show here.

searx/engines/wikipedia.py+7−2

This diff is too big to show here.

searx/languages.py+12−4

This diff is too big to show here.

searx/preferences.py+196−57

This diff is too big to show here.

searx/query.py+3−1

This diff is too big to show here.

searx/results.py+2−2

This diff is too big to show here.

searx/search.py+9−13

This diff is too big to show here.

searx/settings.yml+109−22

This diff is too big to show here.

searx/settings_robot.yml+2−6

This diff is too big to show here.

searx/static/plugins/js/infinite_scroll.js+33−11

This diff is too big to show here.

searx/static/plugins/js/vim_hotkeys.js+10−2

This diff is too big to show here.

searx/static/themes/oscar/.gitignore+1−1

This diff is too big to show here.

searx/static/themes/oscar/gruntfile.js+1−3

This diff is too big to show here.

searx/static/themes/oscar/js/searx.js+3

This diff is too big to show here.

searx/static/themes/oscar/js/searx.min.js+2−2

This diff is too big to show here.

searx/static/themes/oscar/js/searx_src/autocompleter.js+3

This diff is too big to show here.

searx/static/themes/simple/.gitignorenew file+1

This diff is too big to show here.

searx/static/themes/simple/gruntfile.js+3−3

This diff is too big to show here.

searx/templates/__common__/about.html+86−52

This diff is too big to show here.

searx/templates/__common__/opensearch_response_rss.xml+24

This diff is too big to show here.

searx/templates/courgette/github_ribbon.html+1−1

This diff is too big to show here.

searx/templates/oscar/base.html+4−4

This diff is too big to show here.

searx/templates/oscar/infobox.html+1−1

This diff is too big to show here.

searx/templates/oscar/preferences.html+6

This diff is too big to show here.

searx/templates/oscar/results.html+62−62

This diff is too big to show here.

searx/templates/oscar/search.html+1

This diff is too big to show here.

searx/templates/oscar/search_full.html+1

This diff is too big to show here.

searx/templates/simple/base.html+3−3

This diff is too big to show here.

searx/testing.py+18−11

This diff is too big to show here.

searx/translations/ar/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/ar/LC_MESSAGES/messages.po+68−82

This diff is too big to show here.

searx/translations/bg/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/bg/LC_MESSAGES/messages.po+68−82

This diff is too big to show here.

searx/translations/bo/LC_MESSAGES/messages.monew file

Binary file not shown.

searx/translations/bo/LC_MESSAGES/messages.ponew file+998

This diff is too big to show here.

searx/translations/ca/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/ca/LC_MESSAGES/messages.po+69−83

This diff is too big to show here.

searx/translations/cs/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/cs/LC_MESSAGES/messages.po+68−82

This diff is too big to show here.

searx/translations/cy/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/cy/LC_MESSAGES/messages.po+68−83

This diff is too big to show here.

searx/translations/da/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/da/LC_MESSAGES/messages.po+68−83

This diff is too big to show here.

searx/translations/de/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/de/LC_MESSAGES/messages.po+73−86

This diff is too big to show here.

searx/translations/el_GR/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/el_GR/LC_MESSAGES/messages.po+67−82

This diff is too big to show here.

searx/translations/en/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/eo/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/eo/LC_MESSAGES/messages.po+68−83

This diff is too big to show here.

searx/translations/es/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/es/LC_MESSAGES/messages.po+69−84

This diff is too big to show here.

searx/translations/et/LC_MESSAGES/messages.monew file

Binary file not shown.

searx/translations/et/LC_MESSAGES/messages.ponew file+998

This diff is too big to show here.

searx/translations/eu/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/eu/LC_MESSAGES/messages.po+74−89

This diff is too big to show here.

searx/translations/fa_IR/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/fa_IR/LC_MESSAGES/messages.po+71−84

This diff is too big to show here.

searx/translations/fi/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/fi/LC_MESSAGES/messages.po+67−82

This diff is too big to show here.

searx/translations/fil/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/fil/LC_MESSAGES/messages.po+68−83

This diff is too big to show here.

searx/translations/fr/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/fr/LC_MESSAGES/messages.po+69−83

This diff is too big to show here.

searx/translations/gl/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/gl/LC_MESSAGES/messages.po+68−83

This diff is too big to show here.

searx/translations/he/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/he/LC_MESSAGES/messages.po+85−100

This diff is too big to show here.

searx/translations/hr/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/hr/LC_MESSAGES/messages.po+68−83

This diff is too big to show here.

searx/translations/hu/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/hu/LC_MESSAGES/messages.po+67−82

This diff is too big to show here.

searx/translations/ia/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/ia/LC_MESSAGES/messages.po+19−19

This diff is too big to show here.

searx/translations/it/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/it/LC_MESSAGES/messages.po+82−97

This diff is too big to show here.

searx/translations/ja/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/ja/LC_MESSAGES/messages.po+70−84

This diff is too big to show here.

searx/translations/lt/LC_MESSAGES/messages.monew file

Binary file not shown.

searx/translations/lt/LC_MESSAGES/messages.ponew file+998

This diff is too big to show here.

searx/translations/nl/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/nl/LC_MESSAGES/messages.po+67−82

This diff is too big to show here.

searx/translations/nl_BE/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/nl_BE/LC_MESSAGES/messages.po+68−83

This diff is too big to show here.

searx/translations/oc/LC_MESSAGES/messages.monew file

Binary file not shown.

searx/translations/oc/LC_MESSAGES/messages.ponew file+999

This diff is too big to show here.

searx/translations/pl/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/pt/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/pt/LC_MESSAGES/messages.po+69−84

This diff is too big to show here.

searx/translations/pt_BR/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/pt_BR/LC_MESSAGES/messages.po+70−85

This diff is too big to show here.

searx/translations/ro/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/ro/LC_MESSAGES/messages.po+70−83

This diff is too big to show here.

searx/translations/ru/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/ru/LC_MESSAGES/messages.po+68−83

This diff is too big to show here.

searx/translations/sk/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/sk/LC_MESSAGES/messages.po+69−84

This diff is too big to show here.

searx/translations/sl/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/sl/LC_MESSAGES/messages.po+67−82

This diff is too big to show here.

searx/translations/sr/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/sr/LC_MESSAGES/messages.po+70−84

This diff is too big to show here.

searx/translations/sv/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/sv/LC_MESSAGES/messages.po+72−87

This diff is too big to show here.

searx/translations/ta/LC_MESSAGES/messages.monew file

Binary file not shown.

searx/translations/ta/LC_MESSAGES/messages.ponew file+1003

This diff is too big to show here.

searx/translations/te/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/te/LC_MESSAGES/messages.po+67−82

This diff is too big to show here.

searx/translations/tr/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/tr/LC_MESSAGES/messages.po+67−82

This diff is too big to show here.

searx/translations/uk/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/uk/LC_MESSAGES/messages.po+69−83

This diff is too big to show here.

searx/translations/vi/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/vi/LC_MESSAGES/messages.po+68−83

This diff is too big to show here.

searx/translations/zh_CN/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/zh_CN/LC_MESSAGES/messages.po+73−86

This diff is too big to show here.

searx/translations/zh_Hant_TW/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/zh_TW/LC_MESSAGES/messages.mo

Binary file not shown.

searx/translations/zh_TW/LC_MESSAGES/messages.po+71−85

This diff is too big to show here.

searx/version.py+1−1

This diff is too big to show here.

searx/webapp.pymode 100644 → 100755+149−53

This diff is too big to show here.

setup.py+6−1

This diff is too big to show here.

tests/unit/engines/__init__.pydeleted

No changes to the content.

tests/unit/engines/pubmed.pydeleted−37

This diff is too big to show here.

tests/unit/engines/seedpeer_fixture.htmldeleted−110

This diff is too big to show here.

tests/unit/engines/test_acgsou.pydeleted−78

This diff is too big to show here.

tests/unit/engines/test_archlinux.pydeleted−111

This diff is too big to show here.

tests/unit/engines/test_arxiv.pydeleted−58

This diff is too big to show here.

tests/unit/engines/test_base.pydeleted−91

This diff is too big to show here.

tests/unit/engines/test_bing.pydeleted−178

This diff is too big to show here.

tests/unit/engines/test_bing_images.pydeleted−132

This diff is too big to show here.

tests/unit/engines/test_bing_news.pydeleted−147

This diff is too big to show here.

tests/unit/engines/test_bing_videos.pydeleted−72

This diff is too big to show here.

tests/unit/engines/test_btdigg.pydeleted−112

This diff is too big to show here.

tests/unit/engines/test_currency_convert.pydeleted−56

This diff is too big to show here.

tests/unit/engines/test_dailymotion.pydeleted−112

This diff is too big to show here.

tests/unit/engines/test_deezer.pydeleted−57

This diff is too big to show here.

tests/unit/engines/test_deviantart.pydeleted−24

This diff is too big to show here.

tests/unit/engines/test_digbt.pydeleted−61

This diff is too big to show here.

tests/unit/engines/test_digg.pydeleted−16

This diff is too big to show here.

tests/unit/engines/test_doku.pydeleted−79

This diff is too big to show here.

tests/unit/engines/test_duckduckgo.pydeleted−106

This diff is too big to show here.

tests/unit/engines/test_duckduckgo_definitions.pydeleted−255

This diff is too big to show here.

tests/unit/engines/test_duckduckgo_images.pydeleted−75

This diff is too big to show here.

tests/unit/engines/test_duden.pydeleted−47

This diff is too big to show here.

tests/unit/engines/test_dummy.pydeleted−26

This diff is too big to show here.

tests/unit/engines/test_faroo.pydeleted−113

This diff is too big to show here.

tests/unit/engines/test_fdroid.pydeleted−60

This diff is too big to show here.

tests/unit/engines/test_flickr.pydeleted−142

This diff is too big to show here.

tests/unit/engines/test_flickr_noapi.pydeleted−357

This diff is too big to show here.

tests/unit/engines/test_framalibre.pydeleted−103

This diff is too big to show here.

tests/unit/engines/test_frinkiac.pydeleted−50

This diff is too big to show here.

tests/unit/engines/test_genius.pydeleted−231

This diff is too big to show here.

tests/unit/engines/test_gigablast.pydeleted−119

This diff is too big to show here.

tests/unit/engines/test_github.pydeleted−61

This diff is too big to show here.

tests/unit/engines/test_google.pydeleted−194

This diff is too big to show here.

tests/unit/engines/test_google_images.pydeleted−27

This diff is too big to show here.

tests/unit/engines/test_google_news.pydeleted−102

This diff is too big to show here.

tests/unit/engines/test_google_videos.pydeleted−79

This diff is too big to show here.

tests/unit/engines/test_ina.pydeleted−64

This diff is too big to show here.

tests/unit/engines/test_kickass.pydeleted−397

This diff is too big to show here.

tests/unit/engines/test_mediawiki.pydeleted−130

This diff is too big to show here.

tests/unit/engines/test_mixcloud.pydeleted−67

This diff is too big to show here.

tests/unit/engines/test_nyaa.pydeleted−124

This diff is too big to show here.

tests/unit/engines/test_openstreetmap.pydeleted−199

This diff is too big to show here.

tests/unit/engines/test_pdbe.pydeleted−109

This diff is too big to show here.

tests/unit/engines/test_photon.pydeleted−166

This diff is too big to show here.

tests/unit/engines/test_piratebay.pydeleted−166

This diff is too big to show here.

tests/unit/engines/test_qwant.pydeleted−339

This diff is too big to show here.

tests/unit/engines/test_reddit.pydeleted−71

This diff is too big to show here.

tests/unit/engines/test_scanr_structures.pydeleted−175

This diff is too big to show here.

tests/unit/engines/test_searchcode_code.pydeleted−75

This diff is too big to show here.

tests/unit/engines/test_searchcode_doc.pydeleted−70

This diff is too big to show here.

tests/unit/engines/test_seedpeer.pydeleted−66

This diff is too big to show here.

tests/unit/engines/test_soundcloud.pydeleted−192

This diff is too big to show here.

tests/unit/engines/test_spotify.pydeleted−124

This diff is too big to show here.

tests/unit/engines/test_stackoverflow.pydeleted−106

This diff is too big to show here.

tests/unit/engines/test_startpage.pydeleted−67

This diff is too big to show here.

tests/unit/engines/test_tokyotoshokan.pydeleted−110

This diff is too big to show here.

tests/unit/engines/test_torrentz.pydeleted−87

This diff is too big to show here.

tests/unit/engines/test_twitter.pydeleted−502

This diff is too big to show here.

tests/unit/engines/test_unsplash.pydeleted−38

This diff is too big to show here.

tests/unit/engines/test_vimeo.pydeleted−36

This diff is too big to show here.

tests/unit/engines/test_wikidata.pydeleted−514

This diff is too big to show here.

tests/unit/engines/test_wikipedia.pydeleted−263

This diff is too big to show here.

tests/unit/engines/test_wolframalpha_api.pydeleted−166

This diff is too big to show here.

tests/unit/engines/test_wolframalpha_noapi.pydeleted−224

This diff is too big to show here.

tests/unit/engines/test_www1x.pydeleted−14

This diff is too big to show here.

tests/unit/engines/test_yacy.pydeleted−96

This diff is too big to show here.

tests/unit/engines/test_yahoo.pydeleted−190

This diff is too big to show here.

tests/unit/engines/test_yahoo_news.pydeleted−150

This diff is too big to show here.

tests/unit/engines/test_youtube_api.pydeleted−111

This diff is too big to show here.

tests/unit/engines/test_youtube_noapi.pydeleted−124

This diff is too big to show here.

tests/unit/engines/unsplash_fixture.jsondeleted−241

This diff is too big to show here.

tests/unit/test_search.py+71−19

This diff is too big to show here.

tests/unit/test_webapp.py+3−3

This diff is too big to show here.

utils/brand.envnew file+5

This diff is too big to show here.

utils/fetch_firefox_version.py+1−1

This diff is too big to show here.

utils/fetch_languages.py+13−10

This diff is too big to show here.

utils/makefile.python+23−50

This diff is too big to show here.

utils/makefile.sphinxnew file+216

This diff is too big to show here.