diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2020-03-29 13:03:27 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2020-03-29 13:03:27 +0200 |
commit | 65b22be1f4e6bb4f293f3d8cef0c4c7635528090 (patch) | |
tree | b587e13053ac269b686b007e8c3f65dc6eaa9153 | |
parent | 1fcec0bbdad54958abf83715297f77a1f9d81afc (diff) | |
parent | ca65d41da569834435c226407370365224d7867c (diff) | |
download | searxng-65b22be1f4e6bb4f293f3d8cef0c4c7635528090.tar.gz searxng-65b22be1f4e6bb4f293f3d8cef0c4c7635528090.zip |
Merge PR #1900 of https://github.com/asciimoo/searx into filtron
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r-- | .dockerignore | 8 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | .travis.yml | 20 | ||||
-rw-r--r-- | Dockerfile | 3 | ||||
-rw-r--r-- | Makefile | 153 | ||||
-rw-r--r-- | docs/dev/quickstart.rst | 8 | ||||
-rwxr-xr-x | manage.sh | 93 | ||||
-rw-r--r-- | searx/brand.py | 5 | ||||
-rw-r--r-- | searx/data/useragents.json | 9 | ||||
-rw-r--r-- | searx/static/themes/oscar/.gitignore | 2 | ||||
-rw-r--r-- | searx/static/themes/oscar/gruntfile.js | 4 | ||||
-rw-r--r-- | searx/static/themes/simple/.gitignore | 1 | ||||
-rw-r--r-- | searx/static/themes/simple/gruntfile.js | 6 | ||||
-rw-r--r-- | searx/templates/__common__/about.html | 138 | ||||
-rw-r--r-- | searx/templates/courgette/github_ribbon.html | 2 | ||||
-rw-r--r-- | searx/templates/oscar/base.html | 8 | ||||
-rw-r--r-- | searx/templates/simple/base.html | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | searx/webapp.py | 76 | ||||
-rw-r--r-- | setup.py | 7 | ||||
-rw-r--r-- | utils/brand.env | 5 |
20 files changed, 333 insertions, 223 deletions
diff --git a/.dockerignore b/.dockerignore index f4d03376c..044460b20 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,9 @@ */*/*/*~ */*/*/*/*~ +# +local/ + # Git .git .gitignore @@ -36,6 +39,11 @@ robot_report.html test_basic/ setup.cfg +# node_modules node_modules/ +*/node_modules/ +*/*/node_modules/ +*/*/*/node_modules/ +*/*/*/*/node_modules/ .tx/
\ No newline at end of file diff --git a/.gitignore b/.gitignore index 3c998afae..e56a575ab 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ setup.cfg */*.pyc *~ -node_modules/ +/node_modules .tx/ diff --git a/.travis.yml b/.travis.yml index e37b65864..1667cd37c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ language: python sudo: false cache: - - pip - - npm - directories: - $HOME/.cache/pip @@ -10,17 +8,15 @@ addons: firefox: "latest" install: - - ./manage.sh install_geckodriver ~/drivers - - export PATH=~/drivers:$PATH - - ./manage.sh npm_packages - - ./manage.sh update_dev_packages - - pip install codecov + - make install + - make gecko.driver + - make node.env + - local/py3/bin/pip install codecov script: - - ./manage.sh styles - - ./manage.sh grunt_build - - ./manage.sh tests + - make themes + - make test after_success: - - ./manage.sh py_test_coverage + - make test.coverage - codecov stages: @@ -44,7 +40,7 @@ jobs: install: true script: - 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 notifications: diff --git a/Dockerfile b/Dockerfile index 9885fb794..700a21ffc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ EXPOSE 8080 VOLUME /etc/searx VOLUME /var/log/uwsgi +ARG GIT_URL=unknown ARG VERSION_GITCOMMIT=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 ARG LABEL_DATE= -LABEL maintainer="searx <https://github.com/asciimoo/searx>" \ +LABEL maintainer="searx <${GIT_URL}>" \ description="A privacy-respecting, hackable metasearch engine." \ version="${SEARX_GIT_VERSION}" \ org.label-schema.schema-version="1.0" \ @@ -28,6 +28,9 @@ help-min: @echo ' gh-pages - build docs & deploy on gh-pages branch' @echo ' clean - drop builds and environments' @echo ' project - re-build generic files of the searx project' + @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 'environment' @echo ' SEARX_URL = $(SEARX_URL)' @@ -49,7 +52,7 @@ PHONY += uninstall uninstall: pyenvuninstall PHONY += clean -clean: pyclean docs-clean +clean: pyclean docs-clean node.clean test.clean $(call cmd,common_clean) PHONY += run @@ -88,27 +91,124 @@ $(GH_PAGES):: # update project files # -------------------- -PHONY += project engines-languages - -project: searx/data/engines_languages.json - -searx/data/engines_languages.json: pyenvinstall - $(PY_ENV_ACT); python utils/fetch_languages.py - mv engines_languages.json searx/data/engines_languages.json - mv languages.py searx/languages.py +PHONY += project engines.languages searx.brand useragents.update + +project: useragents.update engines.languages searx.brand + +engines.languages: pyenvinstall + $(Q)echo "fetch languages .." + $(Q)$(PY_ENV_ACT); python utils/fetch_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 + +searx.brand: + $(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: + $(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: 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: + $(Q)./manage.sh docker_build + +# gecko +# ----- + +PHONY += gecko.driver +gecko.driver: + $(PY_ENV_ACT); ./manage.sh install_geckodriver # test # ---- -PHONY += test test.sh test.pylint test.pep8 test.unit test.robot - -test: test.pylint test.pep8 test.unit test.robot +PHONY += test test.sh test.pylint test.pep8 test.unit test.coverage test.robot +test: test.pylint test.pep8 test.unit gecko.driver test.robot # TODO: balance linting with pylint test.pylint: pyenvinstall - $(call cmd,pylint,searx/preferences.py) - $(call cmd,pylint,searx/testing.py) + $(call cmd,pylint,\ + searx/preferences.py \ + searx/testing.py \ + ) + +# ignored rules: +# E402 module level import not at top of file +# W503 line break before binary operator # ubu1604: uses shellcheck v0.3.7 (from 04/2015), no longer supported! test.sh: @@ -121,13 +221,26 @@ test.sh: shellcheck -x .config.sh 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 - $(PY_ENV_ACT); ./manage.sh unit_tests - -test.robot: pyenvinstall - $(PY_ENV_ACT); ./manage.sh install_geckodriver - $(PY_ENV_ACT); ./manage.sh robot_tests + @echo "TEST tests/unit" + $(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit + +test.coverage: pyenvinstall + @echo "TEST unit test coverage" + $(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) diff --git a/docs/dev/quickstart.rst b/docs/dev/quickstart.rst index 0fb22d934..a4fc897c4 100644 --- a/docs/dev/quickstart.rst +++ b/docs/dev/quickstart.rst @@ -87,8 +87,8 @@ After satisfying the requirements styles can be build using ``manage.sh`` ./manage.sh styles -How to build the source of the oscar theme -========================================== +How to build the source of the themes +===================================== .. _grunt: https://gruntjs.com/ @@ -98,13 +98,13 @@ NodeJS, so first Node has to be installed. .. code:: sh 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: .. code:: sh - ./manage.sh grunt_build + make themes Tips for debugging/development @@ -10,6 +10,7 @@ PYTHONPATH="$BASE_DIR" SEARX_DIR="$BASE_DIR/searx" ACTION="$1" +. "${BASE_DIR}/utils/brand.env" # # Python @@ -70,45 +71,6 @@ locales() { pybabel compile -d "$SEARX_DIR/translations" } -update_useragents() { - echo '[!] Updating user agent versions' - python utils/fetch_firefox_version.py -} - -pep8_check() { - echo '[!] Running pep8 check' - # ignored rules: - # 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 @@ -135,36 +97,6 @@ npm_packages() { 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() { # Check if it is a git repository if [ ! -d .git ]; then @@ -211,18 +143,18 @@ docker_build() { fi # define the docker image name - # /!\ HACK to get the user name /!\ - GITHUB_USER=$(git remote get-url origin | sed 's/.*github\.com\/\([^\/]*\).*/\1/') + GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/') SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx" # build Docker image echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}" sudo docker build \ + --build-arg GIT_URL="${GIT_URL}" \ --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \ --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \ --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_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_UWSGI=$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini) \ -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 install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests) npm_packages - Download & install npm dependencies - update_useragents - Update useragents.json with the most recent versions of Firefox Build ----- locales - Compile locales - styles - Build less files - grunt_build - Build files for themes - docker_build - Build Docker image - Tests - ----- - unit_tests - Run unit tests - pep8_check - Pep8 validation - robot_tests - Run selenium tests - tests - Run all python tests (pep8, unit, robot_tests) - py_test_coverage - Unit test coverage +Environment: + GIT_URL: ${GIT_URL} + ISSUE_URL: ${ISSUE_URL} + SEARX_URL: ${SEARX_URL} + DOCS_URL: ${DOCS_URL} + PUBLIC_INSTANCES: ${PUBLIC_INSTANCES} " } diff --git a/searx/brand.py b/searx/brand.py new file mode 100644 index 000000000..d563447f6 --- /dev/null +++ b/searx/brand.py @@ -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' diff --git a/searx/data/useragents.json b/searx/data/useragents.json index abb81000c..5ba8c5be8 100644 --- a/searx/data/useragents.json +++ b/searx/data/useragents.json @@ -1,11 +1,8 @@ { "versions": [ - "70.0.1", - "70.0", - "69.0.3", - "69.0.2", - "69.0.1", - "69.0" + "74.0", + "73.0.1", + "73.0" ], "os": [ "Windows NT 10; WOW64", diff --git a/searx/static/themes/oscar/.gitignore b/searx/static/themes/oscar/.gitignore index c2658d7d1..07e6e472c 100644 --- a/searx/static/themes/oscar/.gitignore +++ b/searx/static/themes/oscar/.gitignore @@ -1 +1 @@ -node_modules/ +/node_modules diff --git a/searx/static/themes/oscar/gruntfile.js b/searx/static/themes/oscar/gruntfile.js index def035dba..606b6bcfb 100644 --- a/searx/static/themes/oscar/gruntfile.js +++ b/searx/static/themes/oscar/gruntfile.js @@ -13,7 +13,7 @@ module.exports = function(grunt) { }, uglify: { 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: { files: { @@ -38,7 +38,6 @@ module.exports = function(grunt) { development: { options: { 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", "css/logicodev.css": "less/logicodev-dark/oscar.less", @@ -47,7 +46,6 @@ module.exports = function(grunt) { production: { options: { 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 }, files: {"css/pointhi.min.css": "less/pointhi/oscar.less", diff --git a/searx/static/themes/simple/.gitignore b/searx/static/themes/simple/.gitignore new file mode 100644 index 000000000..07e6e472c --- /dev/null +++ b/searx/static/themes/simple/.gitignore @@ -0,0 +1 @@ +/node_modules diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js index c372ec730..c8f2ed3c6 100644 --- a/searx/static/themes/simple/gruntfile.js +++ b/searx/static/themes/simple/gruntfile.js @@ -36,7 +36,7 @@ module.exports = function(grunt) { }, uglify: { 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: { comments: 'some' }, @@ -57,7 +57,7 @@ module.exports = function(grunt) { development: { options: { 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: { "css/searx.css": "less/style.less", @@ -73,7 +73,7 @@ module.exports = function(grunt) { 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: { "css/searx.min.css": "less/style.less", diff --git a/searx/templates/__common__/about.html b/searx/templates/__common__/about.html index ff86ddd28..5c91c3394 100644 --- a/searx/templates/__common__/about.html +++ b/searx/templates/__common__/about.html @@ -1,63 +1,97 @@ <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> - <h2>Why use searx?</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> - <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> + <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> -<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>, -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> + <ul> <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>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> -</ul> - - -<hr /> - -<h2 id="faq">FAQ</h2> - -<h3>How to add to firefox?</h3> -<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> - -<h2 id="dev_faq">Developer FAQ</h2> - -<h3>New engines?</h3> -<ul> - <li>Edit your <a href="https://raw.github.com/asciimoo/searx/master/searx/settings.yml">settings.yml</a></li> - <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> -<p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p> - -<h3>How to debug engines?</h3> -<p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p> + </ul> + + <hr /> + + <h2>Why use searx?</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> + + <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> + Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, + inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>. + + 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. + + Searx can be added to your browser's search bar; moreover, it can be set as + 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> {% include "__common__/aboutextend.html" ignore missing %} diff --git a/searx/templates/courgette/github_ribbon.html b/searx/templates/courgette/github_ribbon.html index 67c6e678f..bdd9cf180 100644 --- a/searx/templates/courgette/github_ribbon.html +++ b/searx/templates/courgette/github_ribbon.html @@ -1,3 +1,3 @@ <a href="https://github.com/asciimoo/searx" class="github"> <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"/> -</a>
\ No newline at end of file +</a> diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html index 9465ca58a..5eb4462e4 100644 --- a/searx/templates/oscar/base.html +++ b/searx/templates/oscar/base.html @@ -85,10 +85,10 @@ {% endblock %} <p class="text-muted"> <small> - {{ _('Powered by') }} <a href="https://asciimoo.github.io/searx/">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> - <a href="https://github.com/asciimoo/searx">{{ _('Source code') }}</a> | - <a href="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> | - <a href="https://searx.space/">{{ _('Public instances') }}</a> + {{ _('Powered by') }} <a href="{{ brand.DOCS_URL }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> + <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> | + <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> | + <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a> </small> </p> </div> diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index bba02dbf8..71df123ea 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -51,9 +51,9 @@ <footer> <p> {{ _('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="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> | - <a href="https://searx.space/">{{ _('Public instances') }}</a> + <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> | + <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> | + <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a> </p> </footer> <!--[if gte IE 9]>--> diff --git a/searx/webapp.py b/searx/webapp.py index b3928921e..c910230ab 100644..100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -57,6 +57,7 @@ from babel.support import Translations import flask_babel from flask_babel import Babel, gettext, format_date, format_decimal from flask.json import jsonify +from searx import brand from searx import settings, searx_dir, searx_debug from searx.exceptions import SearxParameterException from searx.engines import ( @@ -427,6 +428,8 @@ def render(template_name, override_theme=None, **kwargs): kwargs['preferences'] = request.preferences + kwargs['brand'] = brand + kwargs['scripts'] = set() for plugin in request.user_plugins: for script in plugin.js_dependencies: @@ -955,34 +958,51 @@ def clear_cookies(): @app.route('/config') def config(): - return jsonify({'categories': list(categories.keys()), - 'engines': [{'name': name, - 'categories': engine.categories, - 'shortcut': engine.shortcut, - 'enabled': not engine.disabled, - 'paging': engine.paging, - 'language_support': engine.language_support, - 'supported_languages': - list(engine.supported_languages.keys()) - if isinstance(engine.supported_languages, dict) - else engine.supported_languages, - 'safesearch': engine.safesearch, - 'time_range_support': engine.time_range_support, - 'timeout': engine.timeout} - for name, engine in engines.items() if request.preferences.validate_token(engine)], - 'plugins': [{'name': plugin.name, - 'enabled': plugin.default_on} - for plugin in 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, - 'doi_resolvers': [r for r in settings['doi_resolvers']], - 'default_doi_resolver': settings['default_doi_resolver'], - }) + """Return configuration in JSON format.""" + _engines = [] + for name, engine in engines.items(): + if not request.preferences.validate_token(engine): + continue + + supported_languages = engine.supported_languages + if isinstance(engine.supported_languages, dict): + supported_languages = list(engine.supported_languages.keys()) + + _engines.append({ + 'name': name, + 'categories': engine.categories, + 'shortcut': engine.shortcut, + 'enabled': not engine.disabled, + 'paging': engine.paging, + 'language_support': engine.language_support, + 'supported_languages': supported_languages, + 'safesearch': engine.safesearch, + 'time_range_support': engine.time_range_support, + 'timeout': engine.timeout + }) + + _plugins = [] + for _ in plugins: + _plugins.append({'name': _.name, 'enabled': _.default_on}) + + 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) @@ -10,6 +10,7 @@ import sys # required to load VERSION_STRING constant sys.path.insert(0, './searx') from version import VERSION_STRING +import brand with open('README.rst') as f: long_description = f.read() @@ -25,6 +26,11 @@ setup( version=VERSION_STRING, description="A privacy-respecting, hackable metasearch engine", long_description=long_description, + url=brand.DOCS_URL, + project_urls={ + "Code": brand.GIT_URL, + "Issue tracker": brand.ISSUE_URL + }, classifiers=[ "Development Status :: 4 - Beta", "Programming Language :: Python", @@ -36,7 +42,6 @@ setup( keywords='metasearch searchengine search web http', author='Adam Tauber', author_email='asciimoo@gmail.com', - url='https://github.com/asciimoo/searx', license='GNU Affero General Public License', packages=find_packages(exclude=["tests*"]), zip_safe=False, diff --git a/utils/brand.env b/utils/brand.env new file mode 100644 index 000000000..7fe1a3911 --- /dev/null +++ b/utils/brand.env @@ -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' |