on master help sign in
Merge PR #1900 of https://github.com/asciimoo/searx into filtron

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commit65b22be1f4e6bb4f293f3d8cef0c4c7635528090 authorMarkus Heiser <markus.heiser@darmarit.de> dateSun 29 Mar 2020, 13:03 (7 years ago) parent1fcec0bca65d41
20 files changed+333−223
.dockerignore+8 .gitignore+1−1 .travis.yml+8−12 Dockerfile+2−1 Makefile+133−20 docs/dev/quickstart.rst+4−4 manage.sh+10−83 searx/brand.py+5 searx/data/useragents.json+3−6 searx/static/themes/oscar/.gitignore+1−1 searx/static/themes/oscar/gruntfile.js+1−3 searx/static/themes/simple/.gitignore+1 searx/static/themes/simple/gruntfile.js+3−3 searx/templates/__common__/about.html+86−52 searx/templates/courgette/github_ribbon.html+1−1 searx/templates/oscar/base.html+4−4 searx/templates/simple/base.html+3−3 searx/webapp.py+48−28 setup.py+6−1 utils/brand.env+5
.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+1−1
@@ -16,7 +16,7 @@ setup.cfg
1616*/*.pyc
1717*~
1818
19−node_modules/
19+/node_modules
2020
2121.tx/
2222
.travis.yml+8−12
@@ -1,8 +1,6 @@
11language: python
22sudo: false
33cache:
4− - pip
5− - npm
64 - directories:
75 - $HOME/.cache/pip
86
@@ -10,17 +8,15 @@ addons:
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+ - make install
12+ - make gecko.driver
13+ - make node.env
14+ - local/py3/bin/pip install codecov
1815script:
19− - ./manage.sh styles
20− - ./manage.sh grunt_build
21− - ./manage.sh tests
16+ - make themes
17+ - make test
2218after_success:
23− - ./manage.sh py_test_coverage
19+ - make test.coverage
2420 - codecov
2521
2622stages:
@@ -44,7 +40,7 @@ jobs:
4440 install: true
4541 script:
4642 - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
47− - ./manage.sh docker_build push
43+ - local/py3/bin/activate; ./manage.sh docker_build push
4844 after_success: true
4945
5046notifications:
Dockerfile+2−1
@@ -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" \
Makefile+133−20
@@ -28,6 +28,9 @@ help-min:
2828 @echo ' gh-pages - build docs & deploy on gh-pages branch'
2929 @echo ' clean - drop builds and environments'
3030 @echo ' project - re-build generic files of the searx project'
31+ @echo ' themes - re-build build the source of the themes'
32+ @echo ' docker - build Docker image'
33+ @echo ' node.env - download & install npm dependencies locally'
3134 @echo ''
3235 @echo 'environment'
3336 @echo ' SEARX_URL = $(SEARX_URL)'
@@ -49,7 +52,7 @@ PHONY += uninstall
4952uninstall: pyenvuninstall
5053
5154PHONY += clean
52−clean: pyclean docs-clean
55+clean: pyclean docs-clean node.clean test.clean
5356 $(call cmd,common_clean)
5457
5558PHONY += run
@@ -88,27 +91,124 @@ $(GH_PAGES)::
8891# update project files
8992# --------------------
9093
91−PHONY += project engines-languages
92−
93−project: searx/data/engines_languages.json
94−
95−searx/data/engines_languages.json: pyenvinstall
96− $(PY_ENV_ACT); python utils/fetch_languages.py
97− mv engines_languages.json searx/data/engines_languages.json
98− mv languages.py searx/languages.py
94+PHONY += project engines.languages searx.brand useragents.update
95+
96+project: useragents.update engines.languages searx.brand
97+
98+engines.languages: pyenvinstall
99+ $(Q)echo "fetch languages .."
100+ $(Q)$(PY_ENV_ACT); python utils/fetch_languages.py
101+ $(Q)echo "update searx/data/engines_languages.json"
102+ $(Q)mv engines_languages.json searx/data/engines_languages.json
103+ $(Q)echo "update searx/languages.py"
104+ $(Q)mv languages.py searx/languages.py
105+
106+useragents.update: pyenvinstall
107+ $(Q)echo "Update searx/data/useragents.json with the most recent versions of Firefox."
108+ $(Q)$(PY_ENV_ACT); python utils/fetch_firefox_version.py
109+
110+searx.brand:
111+ $(Q)echo "build searx/brand.py"
112+ $(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
113+ $(Q)echo "ISSUE_URL = 'https://github.com/asciimoo/searx/issues'" >> searx/brand.py
114+ $(Q)echo "SEARX_URL = '$(SEARX_URL)'" >> searx/brand.py
115+ $(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
116+ $(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
117+ $(Q)echo "build utils/brand.env"
118+ $(Q)echo "export GIT_URL='$(GIT_URL)'" > utils/brand.env
119+ $(Q)echo "export ISSUE_URL='https://github.com/asciimoo/searx/issues'" >> utils/brand.env
120+ $(Q)echo "export SEARX_URL='$(SEARX_URL)'" >> utils/brand.env
121+ $(Q)echo "export DOCS_URL='$(DOCS_URL)'" >> utils/brand.env
122+ $(Q)echo "export PUBLIC_INSTANCES='https://searx.space'" >> utils/brand.env
123+
124+
125+# node / npm
126+# ----------
127+
128+node.env:
129+ $(Q)./manage.sh npm_packages
130+
131+node.clean:
132+ $(Q)echo "CLEAN locally installed npm dependencies"
133+ $(Q)rm -rf \
134+ ./node_modules \
135+ ./package-lock.json \
136+ ./searx/static/themes/oscar/package-lock.json \
137+ ./searx/static/themes/oscar/node_modules \
138+ ./searx/static/themes/simple/package-lock.json \
139+ ./searx/static/themes/simple/node_modules
140+
141+# build themes
142+# ------------
143+
144+PHONY += themes.bootstrap themes themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
145+themes: themes.bootstrap themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
146+
147+quiet_cmd_lessc = LESSC $3
148+ cmd_lessc = PATH="$$(npm bin):$$PATH" \
149+ lessc --clean-css="--s1 --advanced --compatibility=ie9" "searx/static/$2" "searx/static/$3"
150+
151+quiet_cmd_grunt = GRUNT $2
152+ cmd_grunt = PATH="$$(npm bin):$$PATH" \
153+ grunt --gruntfile "$2"
154+
155+themes.oscar:
156+ $(Q)echo '[!] build oscar theme'
157+ $(call cmd,grunt,searx/static/themes/oscar/gruntfile.js)
158+
159+themes.simple:
160+ $(Q)echo '[!] build simple theme'
161+ $(call cmd,grunt,searx/static/themes/simple/gruntfile.js)
162+
163+themes.legacy:
164+ $(Q)echo '[!] build legacy theme'
165+ $(call cmd,lessc,themes/legacy/less/style-rtl.less,themes/legacy/css/style-rtl.css)
166+ $(call cmd,lessc,themes/legacy/less/style.less,themes/legacy/css/style.css)
167+
168+themes.courgette:
169+ $(Q)echo '[!] build courgette theme'
170+ $(call cmd,lessc,themes/courgette/less/style.less,themes/courgette/css/style.css)
171+ $(call cmd,lessc,themes/courgette/less/style-rtl.less,themes/courgette/css/style-rtl.css)
172+
173+themes.pixart:
174+ $(Q)echo '[!] build pixart theme'
175+ $(call cmd,lessc,themes/pix-art/less/style.less,themes/pix-art/css/style.css)
176+
177+themes.bootstrap:
178+ $(call cmd,lessc,less/bootstrap/bootstrap.less,css/bootstrap.min.css)
179+
180+
181+# docker
182+# ------
183+
184+PHONY += docker
185+docker:
186+ $(Q)./manage.sh docker_build
187+
188+# gecko
189+# -----
190+
191+PHONY += gecko.driver
192+gecko.driver:
193+ $(PY_ENV_ACT); ./manage.sh install_geckodriver
99194
100195# test
101196# ----
102197
103−PHONY += test test.sh test.pylint test.pep8 test.unit test.robot
104−
105−test: test.pylint test.pep8 test.unit test.robot
198+PHONY += test test.sh test.pylint test.pep8 test.unit test.coverage test.robot
199+test: test.pylint test.pep8 test.unit gecko.driver test.robot
106200
107201# TODO: balance linting with pylint
108202
109203test.pylint: pyenvinstall
110− $(call cmd,pylint,searx/preferences.py)
111− $(call cmd,pylint,searx/testing.py)
204+ $(call cmd,pylint,\
205+ searx/preferences.py \
206+ searx/testing.py \
207+ )
208+
209+# ignored rules:
210+# E402 module level import not at top of file
211+# W503 line break before binary operator
112212
113213# ubu1604: uses shellcheck v0.3.7 (from 04/2015), no longer supported!
114214test.sh:
@@ -121,13 +221,26 @@ test.sh:
121221 shellcheck -x .config.sh
122222
123223test.pep8: pyenvinstall
124− $(PY_ENV_ACT); ./manage.sh pep8_check
224+ @echo "TEST pep8"
225+ $(Q)$(PY_ENV_ACT); pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" searx tests
125226
126227test.unit: pyenvinstall
127− $(PY_ENV_ACT); ./manage.sh unit_tests
128−
129−test.robot: pyenvinstall
130− $(PY_ENV_ACT); ./manage.sh install_geckodriver
131− $(PY_ENV_ACT); ./manage.sh robot_tests
228+ @echo "TEST tests/unit"
229+ $(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
230+
231+test.coverage: pyenvinstall
232+ @echo "TEST unit test coverage"
233+ $(Q)$(PY_ENV_ACT); \
234+ python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit \
235+ && coverage report \
236+ && coverage html \
237+
238+test.robot: pyenvinstall gecko.driver
239+ @echo "TEST robot"
240+ $(Q)$(PY_ENV_ACT); PYTHONPATH=. python searx/testing.py robot
241+
242+test.clean:
243+ @echo "CLEAN intermediate test stuff"
244+ $(Q)rm -rf geckodriver.log .coverage coverage/
132245
133246.PHONY: $(PHONY)
docs/dev/quickstart.rst+4−4
@@ -87,8 +87,8 @@ After satisfying the requirements styles can be build using ``manage.sh``
8787 ./manage.sh styles
8888
8989
90−How to build the source of the oscar theme
91−==========================================
90+How to build the source of the themes
91+=====================================
9292
9393.. _grunt: https://gruntjs.com/
9494
@@ -98,13 +98,13 @@ NodeJS, so first Node has to be installed.
9898.. code:: sh
9999
100100 sudo -H apt-get install nodejs
101− sudo -H npm install -g grunt-cli
101+ make node.env
102102
103103After installing grunt, the files can be built using the following command:
104104
105105.. code:: sh
106106
107− ./manage.sh grunt_build
107+ make themes
108108
109109
110110Tips for debugging/development
manage.sh+10−83
@@ -10,6 +10,7 @@ PYTHONPATH="$BASE_DIR"
1010SEARX_DIR="$BASE_DIR/searx"
1111ACTION="$1"
1212
13+. "${BASE_DIR}/utils/brand.env"
1314
1415#
1516# Python
@@ -70,45 +71,6 @@ locales() {
7071 pybabel compile -d "$SEARX_DIR/translations"
7172}
7273
73−update_useragents() {
74− echo '[!] Updating user agent versions'
75− python utils/fetch_firefox_version.py
76−}
77−
78−pep8_check() {
79− echo '[!] Running pep8 check'
80− # ignored rules:
81− # E402 module level import not at top of file
82− # W503 line break before binary operator
83− pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" "$SEARX_DIR" "$BASE_DIR/tests"
84−}
85−
86−unit_tests() {
87− echo '[!] Running unit tests'
88− python -m nose2 -s "$BASE_DIR/tests/unit"
89−}
90−
91−py_test_coverage() {
92− echo '[!] Running python test coverage'
93− PYTHONPATH="`pwd`" python -m nose2 -C --log-capture --with-coverage --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" \
94− && coverage report \
95− && coverage html
96−}
97−
98−robot_tests() {
99− echo '[!] Running robot tests'
100− PYTHONPATH="`pwd`" python "$SEARX_DIR/testing.py" robot
101−}
102−
103−tests() {
104− set -e
105− pep8_check
106− unit_tests
107− install_geckodriver
108− robot_tests
109− set +e
110−}
111−
11274
11375#
11476# Web
@@ -135,36 +97,6 @@ npm_packages() {
13597 npm install
13698}
13799
138−build_style() {
139− npm_path_setup
140−
141− lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
142−}
143−
144−styles() {
145− npm_path_setup
146−
147− echo '[!] Building legacy style'
148− build_style themes/legacy/less/style.less themes/legacy/css/style.css
149− build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css
150− echo '[!] Building courgette style'
151− build_style themes/courgette/less/style.less themes/courgette/css/style.css
152− build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
153− echo '[!] Building pix-art style'
154− build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
155− echo '[!] Building bootstrap style'
156− build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
157−}
158−
159−grunt_build() {
160− npm_path_setup
161−
162− echo '[!] Grunt build : oscar theme'
163− grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
164− echo '[!] Grunt build : simple theme'
165− grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
166−}
167−
168100docker_build() {
169101 # Check if it is a git repository
170102 if [ ! -d .git ]; then
@@ -211,18 +143,18 @@ docker_build() {
211143 fi
212144
213145 # define the docker image name
214− # /!\ HACK to get the user name /!\
215− GITHUB_USER=$(git remote get-url origin | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
146+ GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
216147 SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx"
217148
218149 # build Docker image
219150 echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
220151 sudo docker build \
152+ --build-arg GIT_URL="${GIT_URL}" \
221153 --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
222154 --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
223155 --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
224156 --build-arg LABEL_VCS_REF=$(git rev-parse HEAD) \
225− --build-arg LABEL_VCS_URL=$(git remote get-url origin) \
157+ --build-arg LABEL_VCS_URL="${GIT_URL}" \
226158 --build-arg TIMESTAMP_SETTINGS=$(git log -1 --format="%cd" --date=unix -- searx/settings.yml) \
227159 --build-arg TIMESTAMP_UWSGI=$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini) \
228160 -t ${SEARX_IMAGE_NAME}:latest -t ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION} .
@@ -251,22 +183,17 @@ Commands
251183 update_dev_packages - Check & update development and production dependency changes
252184 install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests)
253185 npm_packages - Download & install npm dependencies
254− update_useragents - Update useragents.json with the most recent versions of Firefox
255186
256187 Build
257188 -----
258189 locales - Compile locales
259− styles - Build less files
260− grunt_build - Build files for themes
261− docker_build - Build Docker image
262190
263− Tests
264− -----
265− unit_tests - Run unit tests
266− pep8_check - Pep8 validation
267− robot_tests - Run selenium tests
268− tests - Run all python tests (pep8, unit, robot_tests)
269− py_test_coverage - Unit test coverage
191+Environment:
192+ GIT_URL: ${GIT_URL}
193+ ISSUE_URL: ${ISSUE_URL}
194+ SEARX_URL: ${SEARX_URL}
195+ DOCS_URL: ${DOCS_URL}
196+ PUBLIC_INSTANCES: ${PUBLIC_INSTANCES}
270197"
271198}
272199
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/useragents.json+3−6
@@ -1,11 +1,8 @@
11{
22 "versions": [
3− "70.0.1",
4− "70.0",
5− "69.0.3",
6− "69.0.2",
7− "69.0.1",
8− "69.0"
3+ "74.0",
4+ "73.0.1",
5+ "73.0"
96 ],
107 "os": [
118 "Windows NT 10; WOW64",
searx/static/themes/oscar/.gitignore+1−1
@@ -1 +1 @@
1−node_modules/
1+/node_modules
searx/static/themes/oscar/gruntfile.js+1−3
@@ -13,7 +13,7 @@ module.exports = function(grunt) {
1313 },
1414 uglify: {
1515 options: {
16− banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
16+ banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
1717 },
1818 dist: {
1919 files: {
@@ -38,7 +38,6 @@ module.exports = function(grunt) {
3838 development: {
3939 options: {
4040 paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"]
41− //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
4241 },
4342 files: {"css/pointhi.css": "less/pointhi/oscar.less",
4443 "css/logicodev.css": "less/logicodev-dark/oscar.less",
@@ -47,7 +46,6 @@ module.exports = function(grunt) {
4746 production: {
4847 options: {
4948 paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"],
50− //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n',
5149 cleancss: true
5250 },
5351 files: {"css/pointhi.min.css": "less/pointhi/oscar.less",
searx/static/themes/simple/.gitignorenew file+1
@@ -0,0 +1 @@
1+/node_modules
searx/static/themes/simple/gruntfile.js+3−3
@@ -36,7 +36,7 @@ module.exports = function(grunt) {
3636 },
3737 uglify: {
3838 options: {
39− banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n',
39+ banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n',
4040 output: {
4141 comments: 'some'
4242 },
@@ -57,7 +57,7 @@ module.exports = function(grunt) {
5757 development: {
5858 options: {
5959 paths: ["less"],
60− banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
60+ banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
6161 },
6262 files: {
6363 "css/searx.css": "less/style.less",
@@ -73,7 +73,7 @@ module.exports = function(grunt) {
7373 compatibility: '*'
7474 })
7575 ],
76− banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
76+ banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
7777 },
7878 files: {
7979 "css/searx.min.css": "less/style.less",
searx/templates/__common__/about.html+86−52
@@ -1,63 +1,97 @@
11<div{% if rtl %} dir="ltr"{% endif %}>
2− <h1>About <a href="{{ url_for('index') }}">searx</a></h1>
2+ <h1>About <a href="{{ url_for('index') }}">searx</a></h1>
33
4− <p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a> while not storing information about its users.
5− </p>
6− <h2>Why use searx?</h2>
7− <ul>
8− <li>searx may not offer you as personalised results as Google, but it doesn't generate a profile about you</li>
9− <li>searx doesn't care about what you search for, never shares anything with a third party, and it can't be used to compromise you</li>
10− <li>searx is free software, the code is 100% open and you can help to make it better. See more on <a href="https://github.com/asciimoo/searx">github</a></li>
11− </ul>
12− <p>If you do care about privacy, want to be a conscious user, or otherwise believe
13− in digital freedom, make searx your default search engine or run it on your own server</p>
4+ <p>
5+ Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>,
6+ aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a>
7+ while not storing information about its users.
8+ </p>
149
15−<h2>Technical details - How does it work?</h2>
10+ <p>More about searx ...</p>
1611
17−<p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>,
18−inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>.<br />
19−It provides basic privacy by mixing your queries with searches on other platforms without storing search data. Queries are made using a POST request on every browser (except chrome*). Therefore they show up in neither our logs, nor your url history. In case of Chrome* users there is an exception, searx uses the search bar to perform GET requests.<br />
20−Searx can be added to your browser's search bar; moreover, it can be set as the default search engine.
21−</p>
22−
23−<h2>How can I make it my own?</h2>
24−
25−<p>Searx appreciates your concern regarding logs, so take the <a href="https://github.com/asciimoo/searx">code</a> and run it yourself! <br />Add your Searx to this <a href="https://searx.space/">list</a> to help other people reclaim their privacy and make the Internet freer!
26−<br />The more decentralized the Internet is, the more freedom we have!</p>
27−
28−
29−<h2>More about searx</h2>
30−
31−<ul>
12+ <ul>
3213 <li><a href="https://github.com/asciimoo/searx">github</a></li>
33− <li><a href="https://www.ohloh.net/p/searx/">ohloh</a></li>
3414 <li><a href="https://twitter.com/Searx_engine">twitter</a></li>
3515 <li>IRC: #searx @ freenode (<a href="https://kiwiirc.com/client/irc.freenode.com/searx">webclient</a>)</li>
3616 <li><a href="https://www.transifex.com/projects/p/searx/">transifex</a></li>
37−</ul>
38−
39−
40−<hr />
41−
42−<h2 id="faq">FAQ</h2>
43−
44−<h3>How to add to firefox?</h3>
45−<p><a href="#" onclick="window.external.AddSearchProvider(window.location.protocol + '//' + window.location.host + '{{ url_for('opensearch') }}');">Install</a> searx as a search engine on any version of Firefox! (javascript required)</p>
46−
47−<h2 id="dev_faq">Developer FAQ</h2>
48−
49−<h3>New engines?</h3>
50−<ul>
51− <li>Edit your <a href="https://raw.github.com/asciimoo/searx/master/searx/settings.yml">settings.yml</a></li>
52− <li>Create your custom engine module, check the <a href="https://github.com/asciimoo/searx/blob/master/examples/basic_engine.py">example engine</a></li>
53−</ul>
54−<p>Don't forget to restart searx after config edit!</p>
55−
56−<h3>Installation/WSGI support?</h3>
57−<p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p>
58−
59−<h3>How to debug engines?</h3>
60−<p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p>
17+ </ul>
18+
19+ <hr />
20+
21+ <h2>Why use searx?</h2>
22+
23+ <ul>
24+ <li>
25+ Searx may not offer you as personalised results as Google, but it doesn't
26+ generate a profile about you.
27+ </li>
28+ <li>
29+ Searx doesn't care about what you search for, never shares anything with a
30+ third party, and it can't be used to compromise you.
31+ </li>
32+ <li>
33+ Searx is free software, the code is 100% open and you can help to make it
34+ better. See more on <a href="https://github.com/asciimoo/searx">github</a>.
35+ </li>
36+ </ul>
37+
38+ <p>
39+ If you do care about privacy, want to be a conscious user, or otherwise
40+ believe in digital freedom, make searx your default search engine or run it
41+ on your own server
42+ </p>
43+
44+ <h2>Technical details - How does it work?</h2>
45+
46+ <p>
47+ Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>,
48+ inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>.
49+
50+ It provides basic privacy by mixing your queries with searches on other
51+ platforms without storing search data. Queries are made using a POST request
52+ on every browser (except chrome*). Therefore they show up in neither our
53+ logs, nor your url history. In case of Chrome* users there is an exception,
54+ searx uses the search bar to perform GET requests.
55+
56+ Searx can be added to your browser's search bar; moreover, it can be set as
57+ the default search engine.
58+ </p>
59+
60+ <h2 id='add to browser'>How to set as the default search engine?</h2>
61+
62+ <dt>Firefox</dt>
63+
64+ <dd>
65+ <a href="#" onclick="window.external.AddSearchProvider(window.location.protocol + '//' + window.location.host + '{{ url_for('opensearch') }}');">Install</a>
66+ searx as a search engine on any version of Firefox! (javascript required)
67+ </dd>
68+
69+ <h2>Where to find anonymous usage statistics of this instance ?</h2>
70+
71+ <p>
72+ <a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.
73+ </p>
74+
75+ <h2>How can I make it my own?</h2>
76+
77+ <p>
78+ Searx appreciates your concern regarding logs, so take the
79+ code from the <a href="https://github.com/asciimoo/searx">orgin searx project</a> and
80+ run it yourself!
81+ </p>
82+ <p>
83+ Add your searx instance to this <a href="{{ brand.PUBLIC_INSTANCES }}"> list
84+ of public searx instances</a> to help other people reclaim their privacy and
85+ make the Internet freer! The more decentralized the Internet is, the more
86+ freedom we have!
87+ </p>
88+
89+ <h2>Where are the docs & code of this instance?</h2>
90+
91+ <p>
92+ See the <a href="{{ brand.DOCS_URL }}">{{ brand.DOCS_URL }}</a>
93+ and <a href="{{ brand.GIT_URL }}">{{ brand.GIT_URL }}</a>
94+ </p>
6195
6296</div>
6397{% include "__common__/aboutextend.html" ignore missing %}
searx/templates/courgette/github_ribbon.html+1−1
@@ -1,3 +1,3 @@
11<a href="https://github.com/asciimoo/searx" class="github">
22 <img style="position: absolute; top: 0; right: 0; border: 0;" src="{{ url_for('static', filename='img/github_ribbon.png') }}" alt="Fork me on GitHub" class="github"/>
3−</a>
3+</a>
searx/templates/oscar/base.html+4−4
@@ -85,10 +85,10 @@
8585 {% endblock %}
8686 <p class="text-muted">
8787 <small>
88− {{ _('Powered by') }} <a href="https://asciimoo.github.io/searx/">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/>
89− <a href="https://github.com/asciimoo/searx">{{ _('Source code') }}</a> |
90− <a href="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> |
91− <a href="https://searx.space/">{{ _('Public instances') }}</a>
88+ {{ _('Powered by') }} <a href="{{ brand.DOCS_URL }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/>
89+ <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> |
90+ <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> |
91+ <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>
9292 </small>
9393 </p>
9494 </div>
searx/templates/simple/base.html+3−3
@@ -51,9 +51,9 @@
5151 <footer>
5252 <p>
5353 {{ _('Powered by') }} <a href="{{ url_for('about') }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/>
54− <a href="https://github.com/asciimoo/searx">{{ _('Source code') }}</a> |
55− <a href="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> |
56− <a href="https://searx.space/">{{ _('Public instances') }}</a>
54+ <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> |
55+ <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> |
56+ <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>
5757 </p>
5858 </footer>
5959 <!--[if gte IE 9]>-->
searx/webapp.pymode 100644 → 100755+48−28
@@ -57,6 +57,7 @@ from babel.support import Translations
5757import flask_babel
5858from flask_babel import Babel, gettext, format_date, format_decimal
5959from flask.json import jsonify
60+from searx import brand
6061from searx import settings, searx_dir, searx_debug
6162from searx.exceptions import SearxParameterException
6263from searx.engines import (
@@ -427,6 +428,8 @@ def render(template_name, override_theme=None, **kwargs):
427428
428429 kwargs['preferences'] = request.preferences
429430
431+ kwargs['brand'] = brand
432+
430433 kwargs['scripts'] = set()
431434 for plugin in request.user_plugins:
432435 for script in plugin.js_dependencies:
@@ -955,34 +958,51 @@ def clear_cookies():
955958
956959@app.route('/config')
957960def config():
958− return jsonify({'categories': list(categories.keys()),
959− 'engines': [{'name': name,
960− 'categories': engine.categories,
961− 'shortcut': engine.shortcut,
962− 'enabled': not engine.disabled,
963− 'paging': engine.paging,
964− 'language_support': engine.language_support,
965− 'supported_languages':
966− list(engine.supported_languages.keys())
967− if isinstance(engine.supported_languages, dict)
968− else engine.supported_languages,
969− 'safesearch': engine.safesearch,
970− 'time_range_support': engine.time_range_support,
971− 'timeout': engine.timeout}
972− for name, engine in engines.items() if request.preferences.validate_token(engine)],
973− 'plugins': [{'name': plugin.name,
974− 'enabled': plugin.default_on}
975− for plugin in plugins],
976− 'instance_name': settings['general']['instance_name'],
977− 'locales': settings['locales'],
978− 'default_locale': settings['ui']['default_locale'],
979− 'autocomplete': settings['search']['autocomplete'],
980− 'safe_search': settings['search']['safe_search'],
981− 'default_theme': settings['ui']['default_theme'],
982− 'version': VERSION_STRING,
983− 'doi_resolvers': [r for r in settings['doi_resolvers']],
984− 'default_doi_resolver': settings['default_doi_resolver'],
985− })
961+ """Return configuration in JSON format."""
962+ _engines = []
963+ for name, engine in engines.items():
964+ if not request.preferences.validate_token(engine):
965+ continue
966+
967+ supported_languages = engine.supported_languages
968+ if isinstance(engine.supported_languages, dict):
969+ supported_languages = list(engine.supported_languages.keys())
970+
971+ _engines.append({
972+ 'name': name,
973+ 'categories': engine.categories,
974+ 'shortcut': engine.shortcut,
975+ 'enabled': not engine.disabled,
976+ 'paging': engine.paging,
977+ 'language_support': engine.language_support,
978+ 'supported_languages': supported_languages,
979+ 'safesearch': engine.safesearch,
980+ 'time_range_support': engine.time_range_support,
981+ 'timeout': engine.timeout
982+ })
983+
984+ _plugins = []
985+ for _ in plugins:
986+ _plugins.append({'name': _.name, 'enabled': _.default_on})
987+
988+ return jsonify({
989+ 'categories': list(categories.keys()),
990+ 'engines': _engines,
991+ 'plugins': _plugins,
992+ 'instance_name': settings['general']['instance_name'],
993+ 'locales': settings['locales'],
994+ 'default_locale': settings['ui']['default_locale'],
995+ 'autocomplete': settings['search']['autocomplete'],
996+ 'safe_search': settings['search']['safe_search'],
997+ 'default_theme': settings['ui']['default_theme'],
998+ 'version': VERSION_STRING,
999+ 'brand': {
1000+ 'GIT_URL': brand.GIT_URL,
1001+ 'DOCS_URL': brand.DOCS_URL
1002+ },
1003+ 'doi_resolvers': [r for r in settings['doi_resolvers']],
1004+ 'default_doi_resolver': settings['default_doi_resolver'],
1005+ })
9861006
9871007
9881008@app.errorhandler(404)
setup.py+6−1
@@ -10,6 +10,7 @@ import sys
1010# required to load VERSION_STRING constant
1111sys.path.insert(0, './searx')
1212from version import VERSION_STRING
13+import brand
1314
1415with open('README.rst') as f:
1516 long_description = f.read()
@@ -25,6 +26,11 @@ setup(
2526 version=VERSION_STRING,
2627 description="A privacy-respecting, hackable metasearch engine",
2728 long_description=long_description,
29+ url=brand.DOCS_URL,
30+ project_urls={
31+ "Code": brand.GIT_URL,
32+ "Issue tracker": brand.ISSUE_URL
33+ },
2834 classifiers=[
2935 "Development Status :: 4 - Beta",
3036 "Programming Language :: Python",
@@ -36,7 +42,6 @@ setup(
3642 keywords='metasearch searchengine search web http',
3743 author='Adam Tauber',
3844 author_email='asciimoo@gmail.com',
39− url='https://github.com/asciimoo/searx',
4045 license='GNU Affero General Public License',
4146 packages=find_packages(exclude=["tests*"]),
4247 zip_safe=False,
utils/brand.envnew file+5
@@ -0,0 +1,5 @@
1+export GIT_URL='https://github.com/asciimoo/searx'
2+export ISSUE_URL='https://github.com/asciimoo/searx/issues'
3+export SEARX_URL='https://searx.me'
4+export DOCS_URL='https://asciimoo.github.io/searx'
5+export PUBLIC_INSTANCES='https://searx.space'