mirror of
https://github.com/ilyakooo0/searx.git
synced 2024-09-11 09:15:54 +03:00
Merge PR #1900 of https://github.com/asciimoo/searx into filtron
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
commit
65b22be1f4
@ -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/
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,7 +16,7 @@ setup.cfg
|
||||
*/*.pyc
|
||||
*~
|
||||
|
||||
node_modules/
|
||||
/node_modules
|
||||
|
||||
.tx/
|
||||
|
||||
|
20
.travis.yml
20
.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:
|
||||
|
@ -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" \
|
||||
|
147
Makefile
147
Makefile
@ -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
|
||||
PHONY += project engines.languages searx.brand useragents.update
|
||||
|
||||
project: searx/data/engines_languages.json
|
||||
project: useragents.update engines.languages searx.brand
|
||||
|
||||
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
|
||||
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
|
||||
@echo "TEST tests/unit"
|
||||
$(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
|
||||
|
||||
test.robot: pyenvinstall
|
||||
$(PY_ENV_ACT); ./manage.sh install_geckodriver
|
||||
$(PY_ENV_ACT); ./manage.sh robot_tests
|
||||
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)
|
||||
|
@ -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
|
||||
|
93
manage.sh
93
manage.sh
@ -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}
|
||||
"
|
||||
}
|
||||
|
||||
|
5
searx/brand.py
Normal file
5
searx/brand.py
Normal 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'
|
@ -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",
|
||||
|
2
searx/static/themes/oscar/.gitignore
vendored
2
searx/static/themes/oscar/.gitignore
vendored
@ -1 +1 @@
|
||||
node_modules/
|
||||
/node_modules
|
||||
|
@ -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",
|
||||
|
1
searx/static/themes/simple/.gitignore
vendored
Normal file
1
searx/static/themes/simple/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/node_modules
|
@ -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",
|
||||
|
@ -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>
|
||||
</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><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>
|
||||
<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>
|
||||
<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>
|
||||
<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>.
|
||||
|
||||
<h3>Installation/WSGI support?</h3>
|
||||
<p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p>
|
||||
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.
|
||||
|
||||
<h3>How to debug engines?</h3>
|
||||
<p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p>
|
||||
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 %}
|
||||
|
@ -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>
|
||||
</a>
|
||||
|
@ -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>
|
||||
|
@ -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]>-->
|
||||
|
76
searx/webapp.py
Normal file → Executable file
76
searx/webapp.py
Normal file → Executable file
@ -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)
|
||||
|
7
setup.py
7
setup.py
@ -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,
|
||||
|
5
utils/brand.env
Normal file
5
utils/brand.env
Normal 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'
|
Loading…
Reference in New Issue
Block a user