Merge pull request #1900 from return42/issue-1898

export build variables / support brands
This commit is contained in:
Markus Heiser 2020-03-30 14:51:40 +00:00 committed by GitHub
commit 949378a07f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 330 additions and 218 deletions

View File

@ -4,6 +4,9 @@
*/*/*/*~ */*/*/*~
*/*/*/*/*~ */*/*/*/*~
#
local/
# Git # Git
.git .git
.gitignore .gitignore
@ -36,6 +39,11 @@ robot_report.html
test_basic/ test_basic/
setup.cfg setup.cfg
# node_modules
node_modules/ node_modules/
*/node_modules/
*/*/node_modules/
*/*/*/node_modules/
*/*/*/*/node_modules/
.tx/ .tx/

2
.gitignore vendored
View File

@ -15,7 +15,7 @@ setup.cfg
*/*.pyc */*.pyc
*~ *~
node_modules/ /node_modules
.tx/ .tx/

View File

@ -1,8 +1,6 @@
language: python language: python
sudo: false sudo: false
cache: cache:
- pip
- npm
- directories: - directories:
- $HOME/.cache/pip - $HOME/.cache/pip
@ -10,17 +8,15 @@ addons:
firefox: "latest" firefox: "latest"
install: install:
- ./manage.sh install_geckodriver ~/drivers - make install
- export PATH=~/drivers:$PATH - make gecko.driver
- ./manage.sh npm_packages - make node.env
- ./manage.sh update_dev_packages - local/py3/bin/pip install codecov
- pip install codecov
script: script:
- ./manage.sh styles - make themes
- ./manage.sh grunt_build - make test
- ./manage.sh tests
after_success: after_success:
- ./manage.sh py_test_coverage - make test.coverage
- codecov - codecov
stages: stages:
@ -44,7 +40,7 @@ jobs:
install: true install: true
script: script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- ./manage.sh docker_build push - local/py3/bin/activate; ./manage.sh docker_build push
after_success: true after_success: true
notifications: notifications:

View File

@ -4,6 +4,7 @@ EXPOSE 8080
VOLUME /etc/searx VOLUME /etc/searx
VOLUME /var/log/uwsgi VOLUME /var/log/uwsgi
ARG GIT_URL=unknown
ARG VERSION_GITCOMMIT=unknown ARG VERSION_GITCOMMIT=unknown
ARG SEARX_GIT_VERSION=unknown ARG SEARX_GIT_VERSION=unknown
@ -66,7 +67,7 @@ RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
# Keep this argument at the end since it change each time # Keep this argument at the end since it change each time
ARG LABEL_DATE= ARG LABEL_DATE=
LABEL maintainer="searx <https://github.com/asciimoo/searx>" \ LABEL maintainer="searx <${GIT_URL}>" \
description="A privacy-respecting, hackable metasearch engine." \ description="A privacy-respecting, hackable metasearch engine." \
version="${SEARX_GIT_VERSION}" \ version="${SEARX_GIT_VERSION}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \

155
Makefile
View File

@ -28,23 +28,27 @@ help:
@echo ' gh-pages - build docs & deploy on gh-pages branch' @echo ' gh-pages - build docs & deploy on gh-pages branch'
@echo ' clean - drop builds and environments' @echo ' clean - drop builds and environments'
@echo ' project - re-build generic files of the searx project' @echo ' project - re-build generic files of the searx project'
@echo ' buildenv - re-build environment files (aka brand)'
@echo ' themes - re-build build the source of the themes'
@echo ' docker - build Docker image'
@echo ' node.env - download & install npm dependencies locally'
@echo '' @echo ''
@$(MAKE) -s -f utils/makefile.include make-help @$(MAKE) -s -f utils/makefile.include make-help
@echo '' @echo ''
@$(MAKE) -s -f utils/makefile.python python-help @$(MAKE) -s -f utils/makefile.python python-help
PHONY += install PHONY += install
install: pyenvinstall install: buildenv pyenvinstall
PHONY += uninstall PHONY += uninstall
uninstall: pyenvuninstall uninstall: pyenvuninstall
PHONY += clean PHONY += clean
clean: pyclean clean: pyclean node.clean test.clean
$(call cmd,common_clean) $(call cmd,common_clean)
PHONY += run PHONY += run
run: pyenvinstall run: buildenv pyenvinstall
$(Q) ( \ $(Q) ( \
sed -i -e "s/debug : False/debug : True/g" ./searx/settings.yml ; \ sed -i -e "s/debug : False/debug : True/g" ./searx/settings.yml ; \
sleep 2 ; \ sleep 2 ; \
@ -58,11 +62,11 @@ run: pyenvinstall
# ---- # ----
PHONY += docs PHONY += docs
docs: pyenvinstall sphinx-doc docs: buildenv pyenvinstall sphinx-doc
$(call cmd,sphinx,html,docs,docs) $(call cmd,sphinx,html,docs,docs)
PHONY += docs-live PHONY += docs-live
docs-live: pyenvinstall sphinx-live docs-live: buildenv pyenvinstall sphinx-live
$(call cmd,sphinx_autobuild,html,docs,docs) $(call cmd,sphinx_autobuild,html,docs,docs)
$(GH_PAGES):: $(GH_PAGES)::
@ -71,35 +75,146 @@ $(GH_PAGES)::
# update project files # update project files
# -------------------- # --------------------
PHONY += project engines-languages PHONY += project engines.languages useragents.update buildenv
project: searx/data/engines_languages.json project: buildenv useragents.update engines.languages
searx/data/engines_languages.json: pyenvinstall engines.languages: pyenvinstall
$(PY_ENV_ACT); python utils/fetch_languages.py $(Q)echo "fetch languages .."
mv engines_languages.json searx/data/engines_languages.json $(Q)$(PY_ENV_ACT); python utils/fetch_languages.py
mv languages.py searx/languages.py $(Q)echo "update searx/data/engines_languages.json"
$(Q)mv engines_languages.json searx/data/engines_languages.json
$(Q)echo "update searx/languages.py"
$(Q)mv languages.py searx/languages.py
useragents.update: pyenvinstall
$(Q)echo "Update searx/data/useragents.json with the most recent versions of Firefox."
$(Q)$(PY_ENV_ACT); python utils/fetch_firefox_version.py
buildenv:
$(Q)echo "build searx/brand.py"
$(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
$(Q)echo "ISSUE_URL = 'https://github.com/asciimoo/searx/issues'" >> searx/brand.py
$(Q)echo "SEARX_URL = '$(SEARX_URL)'" >> searx/brand.py
$(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
$(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
$(Q)echo "build utils/brand.env"
$(Q)echo "export GIT_URL='$(GIT_URL)'" > utils/brand.env
$(Q)echo "export ISSUE_URL='https://github.com/asciimoo/searx/issues'" >> utils/brand.env
$(Q)echo "export SEARX_URL='$(SEARX_URL)'" >> utils/brand.env
$(Q)echo "export DOCS_URL='$(DOCS_URL)'" >> utils/brand.env
$(Q)echo "export PUBLIC_INSTANCES='https://searx.space'" >> utils/brand.env
# node / npm
# ----------
node.env: buildenv
$(Q)./manage.sh npm_packages
node.clean:
$(Q)echo "CLEAN locally installed npm dependencies"
$(Q)rm -rf \
./node_modules \
./package-lock.json \
./searx/static/themes/oscar/package-lock.json \
./searx/static/themes/oscar/node_modules \
./searx/static/themes/simple/package-lock.json \
./searx/static/themes/simple/node_modules
# build themes
# ------------
PHONY += themes.bootstrap themes themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
themes: buildenv themes.bootstrap themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
quiet_cmd_lessc = LESSC $3
cmd_lessc = PATH="$$(npm bin):$$PATH" \
lessc --clean-css="--s1 --advanced --compatibility=ie9" "searx/static/$2" "searx/static/$3"
quiet_cmd_grunt = GRUNT $2
cmd_grunt = PATH="$$(npm bin):$$PATH" \
grunt --gruntfile "$2"
themes.oscar:
$(Q)echo '[!] build oscar theme'
$(call cmd,grunt,searx/static/themes/oscar/gruntfile.js)
themes.simple:
$(Q)echo '[!] build simple theme'
$(call cmd,grunt,searx/static/themes/simple/gruntfile.js)
themes.legacy:
$(Q)echo '[!] build legacy theme'
$(call cmd,lessc,themes/legacy/less/style-rtl.less,themes/legacy/css/style-rtl.css)
$(call cmd,lessc,themes/legacy/less/style.less,themes/legacy/css/style.css)
themes.courgette:
$(Q)echo '[!] build courgette theme'
$(call cmd,lessc,themes/courgette/less/style.less,themes/courgette/css/style.css)
$(call cmd,lessc,themes/courgette/less/style-rtl.less,themes/courgette/css/style-rtl.css)
themes.pixart:
$(Q)echo '[!] build pixart theme'
$(call cmd,lessc,themes/pix-art/less/style.less,themes/pix-art/css/style.css)
themes.bootstrap:
$(call cmd,lessc,less/bootstrap/bootstrap.less,css/bootstrap.min.css)
# docker
# ------
PHONY += docker
docker: buildenv
$(Q)./manage.sh docker_build
# gecko
# -----
PHONY += gecko.driver
gecko.driver:
$(PY_ENV_ACT); ./manage.sh install_geckodriver
# test # test
# ---- # ----
PHONY += test test.pylint test.pep8 test.unit test.robot PHONY += test test.pylint test.pep8 test.unit test.coverage test.robot
test: test.pylint test.pep8 test.unit test.robot test: buildenv test.pylint test.pep8 test.unit gecko.driver test.robot
# TODO: balance linting with pylint # TODO: balance linting with pylint
test.pylint: pyenvinstall test.pylint: pyenvinstall
$(call cmd,pylint,searx/preferences.py) $(call cmd,pylint,\
$(call cmd,pylint,searx/testing.py) searx/preferences.py \
searx/testing.py \
)
# ignored rules:
# E402 module level import not at top of file
# W503 line break before binary operator
test.pep8: pyenvinstall test.pep8: pyenvinstall
$(PY_ENV_ACT); ./manage.sh pep8_check @echo "TEST pep8"
$(Q)$(PY_ENV_ACT); pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" searx tests
test.unit: pyenvinstall test.unit: pyenvinstall
$(PY_ENV_ACT); ./manage.sh unit_tests @echo "TEST tests/unit"
$(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
test.robot: pyenvinstall test.coverage: pyenvinstall
$(PY_ENV_ACT); ./manage.sh install_geckodriver @echo "TEST unit test coverage"
$(PY_ENV_ACT); ./manage.sh robot_tests $(Q)$(PY_ENV_ACT); \
python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit \
&& coverage report \
&& coverage html \
test.robot: pyenvinstall gecko.driver
@echo "TEST robot"
$(Q)$(PY_ENV_ACT); PYTHONPATH=. python searx/testing.py robot
test.clean:
@echo "CLEAN intermediate test stuff"
$(Q)rm -rf geckodriver.log .coverage coverage/
.PHONY: $(PHONY) .PHONY: $(PHONY)

View File

@ -4,9 +4,9 @@ import sys, os
from searx.version import VERSION_STRING from searx.version import VERSION_STRING
from pallets_sphinx_themes import ProjectLink from pallets_sphinx_themes import ProjectLink
GIT_URL = os.environ.get("GIT_URL", "https://github.com/asciimoo/searx") from searx.brand import GIT_URL
SEARX_URL = os.environ.get("SEARX_URL", "https://searx.me") from searx.brand import SEARX_URL
DOCS_URL = os.environ.get("DOCS_URL", "https://asciimoo.github.io/searx/") from searx.brand import DOCS_URL
# Project -------------------------------------------------------------- # Project --------------------------------------------------------------

View File

@ -87,8 +87,8 @@ After satisfying the requirements styles can be build using ``manage.sh``
./manage.sh styles ./manage.sh styles
How to build the source of the oscar theme How to build the source of the themes
========================================== =====================================
.. _grunt: https://gruntjs.com/ .. _grunt: https://gruntjs.com/
@ -98,13 +98,13 @@ NodeJS, so first Node has to be installed.
.. code:: sh .. code:: sh
sudo -H apt-get install nodejs sudo -H apt-get install nodejs
sudo -H npm install -g grunt-cli make node.env
After installing grunt, the files can be built using the following command: After installing grunt, the files can be built using the following command:
.. code:: sh .. code:: sh
./manage.sh grunt_build make themes
Tips for debugging/development Tips for debugging/development

View File

@ -10,6 +10,7 @@ PYTHONPATH="$BASE_DIR"
SEARX_DIR="$BASE_DIR/searx" SEARX_DIR="$BASE_DIR/searx"
ACTION="$1" ACTION="$1"
. "${BASE_DIR}/utils/brand.env"
# #
# Python # Python
@ -70,45 +71,6 @@ locales() {
pybabel compile -d "$SEARX_DIR/translations" pybabel compile -d "$SEARX_DIR/translations"
} }
update_useragents() {
echo '[!] Updating user agent versions'
python utils/fetch_firefox_version.py
}
pep8_check() {
echo '[!] Running pep8 check'
# ignored rules:
# E402 module level import not at top of file
# W503 line break before binary operator
pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" "$SEARX_DIR" "$BASE_DIR/tests"
}
unit_tests() {
echo '[!] Running unit tests'
python -m nose2 -s "$BASE_DIR/tests/unit"
}
py_test_coverage() {
echo '[!] Running python test coverage'
PYTHONPATH="`pwd`" python -m nose2 -C --log-capture --with-coverage --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" \
&& coverage report \
&& coverage html
}
robot_tests() {
echo '[!] Running robot tests'
PYTHONPATH="`pwd`" python "$SEARX_DIR/testing.py" robot
}
tests() {
set -e
pep8_check
unit_tests
install_geckodriver
robot_tests
set +e
}
# #
# Web # Web
@ -135,36 +97,6 @@ npm_packages() {
npm install npm install
} }
build_style() {
npm_path_setup
lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
}
styles() {
npm_path_setup
echo '[!] Building legacy style'
build_style themes/legacy/less/style.less themes/legacy/css/style.css
build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css
echo '[!] Building courgette style'
build_style themes/courgette/less/style.less themes/courgette/css/style.css
build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
echo '[!] Building pix-art style'
build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
echo '[!] Building bootstrap style'
build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
}
grunt_build() {
npm_path_setup
echo '[!] Grunt build : oscar theme'
grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
echo '[!] Grunt build : simple theme'
grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
}
docker_build() { docker_build() {
# Check if it is a git repository # Check if it is a git repository
if [ ! -d .git ]; then if [ ! -d .git ]; then
@ -211,18 +143,18 @@ docker_build() {
fi fi
# define the docker image name # define the docker image name
# /!\ HACK to get the user name /!\ GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
GITHUB_USER=$(git remote get-url origin | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx" SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx"
# build Docker image # build Docker image
echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}" echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
sudo docker build \ sudo docker build \
--build-arg GIT_URL="${GIT_URL}" \
--build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \ --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
--build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \ --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
--build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--build-arg LABEL_VCS_REF=$(git rev-parse HEAD) \ --build-arg LABEL_VCS_REF=$(git rev-parse HEAD) \
--build-arg LABEL_VCS_URL=$(git remote get-url origin) \ --build-arg LABEL_VCS_URL="${GIT_URL}" \
--build-arg TIMESTAMP_SETTINGS=$(git log -1 --format="%cd" --date=unix -- searx/settings.yml) \ --build-arg TIMESTAMP_SETTINGS=$(git log -1 --format="%cd" --date=unix -- searx/settings.yml) \
--build-arg TIMESTAMP_UWSGI=$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini) \ --build-arg TIMESTAMP_UWSGI=$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini) \
-t ${SEARX_IMAGE_NAME}:latest -t ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION} . -t ${SEARX_IMAGE_NAME}:latest -t ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION} .
@ -251,22 +183,17 @@ Commands
update_dev_packages - Check & update development and production dependency changes update_dev_packages - Check & update development and production dependency changes
install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests) install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests)
npm_packages - Download & install npm dependencies npm_packages - Download & install npm dependencies
update_useragents - Update useragents.json with the most recent versions of Firefox
Build Build
----- -----
locales - Compile locales locales - Compile locales
styles - Build less files
grunt_build - Build files for themes
docker_build - Build Docker image
Tests Environment:
----- GIT_URL: ${GIT_URL}
unit_tests - Run unit tests ISSUE_URL: ${ISSUE_URL}
pep8_check - Pep8 validation SEARX_URL: ${SEARX_URL}
robot_tests - Run selenium tests DOCS_URL: ${DOCS_URL}
tests - Run all python tests (pep8, unit, robot_tests) PUBLIC_INSTANCES: ${PUBLIC_INSTANCES}
py_test_coverage - Unit test coverage
" "
} }

5
searx/brand.py Normal file
View File

@ -0,0 +1,5 @@
GIT_URL = 'https://github.com/asciimoo/searx'
ISSUE_URL = 'https://github.com/asciimoo/searx/issues'
SEARX_URL = 'https://searx.me'
DOCS_URL = 'https://asciimoo.github.io/searx'
PUBLIC_INSTANCES = 'https://searx.space'

View File

@ -1,11 +1,8 @@
{ {
"versions": [ "versions": [
"70.0.1", "74.0",
"70.0", "73.0.1",
"69.0.3", "73.0"
"69.0.2",
"69.0.1",
"69.0"
], ],
"os": [ "os": [
"Windows NT 10; WOW64", "Windows NT 10; WOW64",

View File

@ -1 +1 @@
node_modules/ /node_modules

View File

@ -13,7 +13,7 @@ module.exports = function(grunt) {
}, },
uglify: { uglify: {
options: { options: {
banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
}, },
dist: { dist: {
files: { files: {
@ -38,7 +38,6 @@ module.exports = function(grunt) {
development: { development: {
options: { options: {
paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"] paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"]
//banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
}, },
files: {"css/pointhi.css": "less/pointhi/oscar.less", files: {"css/pointhi.css": "less/pointhi/oscar.less",
"css/logicodev.css": "less/logicodev-dark/oscar.less", "css/logicodev.css": "less/logicodev-dark/oscar.less",
@ -47,7 +46,6 @@ module.exports = function(grunt) {
production: { production: {
options: { options: {
paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"], paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"],
//banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n',
cleancss: true cleancss: true
}, },
files: {"css/pointhi.min.css": "less/pointhi/oscar.less", files: {"css/pointhi.min.css": "less/pointhi/oscar.less",

1
searx/static/themes/simple/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/node_modules

View File

@ -36,7 +36,7 @@ module.exports = function(grunt) {
}, },
uglify: { uglify: {
options: { options: {
banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n', banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n',
output: { output: {
comments: 'some' comments: 'some'
}, },
@ -57,7 +57,7 @@ module.exports = function(grunt) {
development: { development: {
options: { options: {
paths: ["less"], paths: ["less"],
banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
}, },
files: { files: {
"css/searx.css": "less/style.less", "css/searx.css": "less/style.less",
@ -73,7 +73,7 @@ module.exports = function(grunt) {
compatibility: '*' compatibility: '*'
}) })
], ],
banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
}, },
files: { files: {
"css/searx.min.css": "less/style.less", "css/searx.min.css": "less/style.less",

View File

@ -1,63 +1,97 @@
<div{% if rtl %} dir="ltr"{% endif %}> <div{% if rtl %} dir="ltr"{% endif %}>
<h1>About <a href="{{ url_for('index') }}">searx</a></h1> <h1>About <a href="{{ url_for('index') }}">searx</a></h1>
<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. <p>
</p> Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>,
<h2>Why use searx?</h2> aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a>
<ul> while not storing information about its users.
<li>searx may not offer you as personalised results as Google, but it doesn't generate a profile about you</li> </p>
<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>
<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>
</ul>
<p>If you do care about privacy, want to be a conscious user, or otherwise believe
in digital freedom, make searx your default search engine or run it on your own server</p>
<h2>Technical details - How does it work?</h2> <p>More about searx ...</p>
<p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, <ul>
inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>.<br />
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 />
Searx can be added to your browser's search bar; moreover, it can be set as the default search engine.
</p>
<h2>How can I make it my own?</h2>
<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!
<br />The more decentralized the Internet is, the more freedom we have!</p>
<h2>More about searx</h2>
<ul>
<li><a href="https://github.com/asciimoo/searx">github</a></li> <li><a href="https://github.com/asciimoo/searx">github</a></li>
<li><a href="https://www.ohloh.net/p/searx/">ohloh</a></li>
<li><a href="https://twitter.com/Searx_engine">twitter</a></li> <li><a href="https://twitter.com/Searx_engine">twitter</a></li>
<li>IRC: #searx @ freenode (<a href="https://kiwiirc.com/client/irc.freenode.com/searx">webclient</a>)</li> <li>IRC: #searx @ freenode (<a href="https://kiwiirc.com/client/irc.freenode.com/searx">webclient</a>)</li>
<li><a href="https://www.transifex.com/projects/p/searx/">transifex</a></li> <li><a href="https://www.transifex.com/projects/p/searx/">transifex</a></li>
</ul> </ul>
<hr />
<hr /> <h2>Why use searx?</h2>
<h2 id="faq">FAQ</h2> <ul>
<li>
Searx may not offer you as personalised results as Google, but it doesn't
generate a profile about you.
</li>
<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>
<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>
</ul>
<h3>How to add to firefox?</h3> <p>
<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> If you do care about privacy, want to be a conscious user, or otherwise
believe in digital freedom, make searx your default search engine or run it
on your own server
</p>
<h2 id="dev_faq">Developer FAQ</h2> <h2>Technical details - How does it work?</h2>
<h3>New engines?</h3> <p>
<ul> Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>,
<li>Edit your <a href="https://raw.github.com/asciimoo/searx/master/searx/settings.yml">settings.yml</a></li> inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>.
<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>
</ul>
<p>Don't forget to restart searx after config edit!</p>
<h3>Installation/WSGI support?</h3> It provides basic privacy by mixing your queries with searches on other
<p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p> 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.
<h3>How to debug engines?</h3> Searx can be added to your browser's search bar; moreover, it can be set as
<p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p> the default search engine.
</p>
<h2 id='add to browser'>How to set as the default search engine?</h2>
<dt>Firefox</dt>
<dd>
<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)
</dd>
<h2>Where to find anonymous usage statistics of this instance ?</h2>
<p>
<a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.
</p>
<h2>How can I make it my own?</h2>
<p>
Searx appreciates your concern regarding logs, so take the
code from the <a href="https://github.com/asciimoo/searx">orgin searx project</a> and
run it yourself!
</p>
<p>
Add your searx instance to this <a href="{{ brand.PUBLIC_INSTANCES }}"> list
of public searx instances</a> to help other people reclaim their privacy and
make the Internet freer! The more decentralized the Internet is, the more
freedom we have!
</p>
<h2>Where are the docs & code of this instance?</h2>
<p>
See the <a href="{{ brand.DOCS_URL }}">{{ brand.DOCS_URL }}</a>
and <a href="{{ brand.GIT_URL }}">{{ brand.GIT_URL }}</a>
</p>
</div> </div>
{% include "__common__/aboutextend.html" ignore missing %} {% include "__common__/aboutextend.html" ignore missing %}

View File

@ -85,10 +85,10 @@
{% endblock %} {% endblock %}
<p class="text-muted"> <p class="text-muted">
<small> <small>
{{ _('Powered by') }} <a href="https://asciimoo.github.io/searx/">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> {{ _('Powered by') }} <a href="{{ brand.DOCS_URL }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/>
<a href="https://github.com/asciimoo/searx">{{ _('Source code') }}</a> | <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> |
<a href="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> | <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> |
<a href="https://searx.space/">{{ _('Public instances') }}</a> <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>
</small> </small>
</p> </p>
</div> </div>

View File

@ -51,9 +51,9 @@
<footer> <footer>
<p> <p>
{{ _('Powered by') }} <a href="{{ url_for('about') }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> {{ _('Powered by') }} <a href="{{ url_for('about') }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/>
<a href="https://github.com/asciimoo/searx">{{ _('Source code') }}</a> | <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> |
<a href="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> | <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> |
<a href="https://searx.space/">{{ _('Public instances') }}</a> <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>
</p> </p>
</footer> </footer>
<!--[if gte IE 9]>--> <!--[if gte IE 9]>-->

76
searx/webapp.py Normal file → Executable file
View File

@ -57,6 +57,7 @@ from babel.support import Translations
import flask_babel import flask_babel
from flask_babel import Babel, gettext, format_date, format_decimal from flask_babel import Babel, gettext, format_date, format_decimal
from flask.json import jsonify from flask.json import jsonify
from searx import brand
from searx import settings, searx_dir, searx_debug from searx import settings, searx_dir, searx_debug
from searx.exceptions import SearxParameterException from searx.exceptions import SearxParameterException
from searx.engines import ( from searx.engines import (
@ -427,6 +428,8 @@ def render(template_name, override_theme=None, **kwargs):
kwargs['preferences'] = request.preferences kwargs['preferences'] = request.preferences
kwargs['brand'] = brand
kwargs['scripts'] = set() kwargs['scripts'] = set()
for plugin in request.user_plugins: for plugin in request.user_plugins:
for script in plugin.js_dependencies: for script in plugin.js_dependencies:
@ -955,34 +958,51 @@ def clear_cookies():
@app.route('/config') @app.route('/config')
def config(): def config():
return jsonify({'categories': list(categories.keys()), """Return configuration in JSON format."""
'engines': [{'name': name, _engines = []
'categories': engine.categories, for name, engine in engines.items():
'shortcut': engine.shortcut, if not request.preferences.validate_token(engine):
'enabled': not engine.disabled, continue
'paging': engine.paging,
'language_support': engine.language_support, supported_languages = engine.supported_languages
'supported_languages': if isinstance(engine.supported_languages, dict):
list(engine.supported_languages.keys()) supported_languages = list(engine.supported_languages.keys())
if isinstance(engine.supported_languages, dict)
else engine.supported_languages, _engines.append({
'safesearch': engine.safesearch, 'name': name,
'time_range_support': engine.time_range_support, 'categories': engine.categories,
'timeout': engine.timeout} 'shortcut': engine.shortcut,
for name, engine in engines.items() if request.preferences.validate_token(engine)], 'enabled': not engine.disabled,
'plugins': [{'name': plugin.name, 'paging': engine.paging,
'enabled': plugin.default_on} 'language_support': engine.language_support,
for plugin in plugins], 'supported_languages': supported_languages,
'instance_name': settings['general']['instance_name'], 'safesearch': engine.safesearch,
'locales': settings['locales'], 'time_range_support': engine.time_range_support,
'default_locale': settings['ui']['default_locale'], 'timeout': engine.timeout
'autocomplete': settings['search']['autocomplete'], })
'safe_search': settings['search']['safe_search'],
'default_theme': settings['ui']['default_theme'], _plugins = []
'version': VERSION_STRING, for _ in plugins:
'doi_resolvers': [r for r in settings['doi_resolvers']], _plugins.append({'name': _.name, 'enabled': _.default_on})
'default_doi_resolver': settings['default_doi_resolver'],
}) return jsonify({
'categories': list(categories.keys()),
'engines': _engines,
'plugins': _plugins,
'instance_name': settings['general']['instance_name'],
'locales': settings['locales'],
'default_locale': settings['ui']['default_locale'],
'autocomplete': settings['search']['autocomplete'],
'safe_search': settings['search']['safe_search'],
'default_theme': settings['ui']['default_theme'],
'version': VERSION_STRING,
'brand': {
'GIT_URL': brand.GIT_URL,
'DOCS_URL': brand.DOCS_URL
},
'doi_resolvers': [r for r in settings['doi_resolvers']],
'default_doi_resolver': settings['default_doi_resolver'],
})
@app.errorhandler(404) @app.errorhandler(404)

View File

@ -10,6 +10,7 @@ import sys
# required to load VERSION_STRING constant # required to load VERSION_STRING constant
sys.path.insert(0, './searx') sys.path.insert(0, './searx')
from version import VERSION_STRING from version import VERSION_STRING
import brand
with open('README.rst') as f: with open('README.rst') as f:
long_description = f.read() long_description = f.read()
@ -25,6 +26,11 @@ setup(
version=VERSION_STRING, version=VERSION_STRING,
description="A privacy-respecting, hackable metasearch engine", description="A privacy-respecting, hackable metasearch engine",
long_description=long_description, long_description=long_description,
url=brand.DOCS_URL,
project_urls={
"Code": brand.GIT_URL,
"Issue tracker": brand.ISSUE_URL
},
classifiers=[ classifiers=[
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
"Programming Language :: Python", "Programming Language :: Python",
@ -36,7 +42,6 @@ setup(
keywords='metasearch searchengine search web http', keywords='metasearch searchengine search web http',
author='Adam Tauber', author='Adam Tauber',
author_email='asciimoo@gmail.com', author_email='asciimoo@gmail.com',
url='https://github.com/asciimoo/searx',
license='GNU Affero General Public License', license='GNU Affero General Public License',
packages=find_packages(exclude=["tests*"]), packages=find_packages(exclude=["tests*"]),
zip_safe=False, zip_safe=False,

5
utils/brand.env Normal file
View File

@ -0,0 +1,5 @@
export GIT_URL='https://github.com/asciimoo/searx'
export ISSUE_URL='https://github.com/asciimoo/searx/issues'
export SEARX_URL='https://searx.me'
export DOCS_URL='https://asciimoo.github.io/searx'
export PUBLIC_INSTANCES='https://searx.space'