From 04c687403e21f883f9614e6a24df9ec450cfc111 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 11:49:33 +0100
Subject: [PATCH 01/25] [fix] brands: add variables from build env to jinja
templating
We have some variables in the build environment which are also needed in the
templating process. Theses variables are relavant if one creates a fork with
its own branding. We treat these variables under the term 'brands'.
Signed-off-by: Markus Heiser
---
Makefile | 13 ++++++++++---
searx/templates/__common__/about.html | 12 ++++++------
searx/templates/courgette/github_ribbon.html | 4 ++--
searx/templates/legacy/github_ribbon.html | 2 +-
searx/templates/oscar/base.html | 8 ++++----
searx/templates/simple/base.html | 6 +++---
searx/webapp.py | 3 +++
7 files changed, 29 insertions(+), 19 deletions(-)
mode change 100644 => 100755 searx/webapp.py
diff --git a/Makefile b/Makefile
index 5a47129e4..3b2d499e8 100644
--- a/Makefile
+++ b/Makefile
@@ -71,15 +71,22 @@ $(GH_PAGES)::
# update project files
# --------------------
-PHONY += project engines-languages
+PHONY += project engines-languages searx.brand
-project: searx/data/engines_languages.json
+project: searx/data/engines_languages.json searx.brand
-searx/data/engines_languages.json: pyenvinstall
+engines-languages: pyenvinstall
$(PY_ENV_ACT); python utils/fetch_languages.py
mv engines_languages.json searx/data/engines_languages.json
mv languages.py searx/languages.py
+searx.brand:
+ $(Q)echo "build searx/brand.py"
+ $(Q)echo "GIT_URL = '$(GIT_URL)'" > 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
+
# test
# ----
diff --git a/searx/templates/__common__/about.html b/searx/templates/__common__/about.html
index ff86ddd28..d8e1335d9 100644
--- a/searx/templates/__common__/about.html
+++ b/searx/templates/__common__/about.html
@@ -7,7 +7,7 @@
- searx may not offer you as personalised results as Google, but it doesn't generate a profile about you
- 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
- - searx is free software, the code is 100% open and you can help to make it better. See more on github
+ - searx is free software, the code is 100% open and you can help to make it better. See more on github
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
@@ -22,14 +22,14 @@ Searx can be added to your browser's search bar; moreover, it can be set as the
How can I make it my own?
-Searx appreciates your concern regarding logs, so take the code and run it yourself!
Add your Searx to this list to help other people reclaim their privacy and make the Internet freer!
+
Searx appreciates your concern regarding logs, so take the code and run it yourself!
Add your Searx to this list to help other people reclaim their privacy and make the Internet freer!
The more decentralized the Internet is, the more freedom we have!
More about searx
- - github
+ - github
- ohloh
- twitter
- IRC: #searx @ freenode (webclient)
@@ -48,13 +48,13 @@ Searx can be added to your browser's search bar; moreover, it can be set as the
New engines?
Don't forget to restart searx after config edit!
Installation/WSGI support?
-See the installation and setup wiki page
+See the installation and uwsgi setup
How to debug engines?
Stats page contains some useful data about the engines used.
diff --git a/searx/templates/courgette/github_ribbon.html b/searx/templates/courgette/github_ribbon.html
index 67c6e678f..f6eaa123c 100644
--- a/searx/templates/courgette/github_ribbon.html
+++ b/searx/templates/courgette/github_ribbon.html
@@ -1,3 +1,3 @@
-
+
-
\ No newline at end of file
+
diff --git a/searx/templates/legacy/github_ribbon.html b/searx/templates/legacy/github_ribbon.html
index bdd9cf180..f6eaa123c 100644
--- a/searx/templates/legacy/github_ribbon.html
+++ b/searx/templates/legacy/github_ribbon.html
@@ -1,3 +1,3 @@
-
+
diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html
index 9465ca58a..4fe335798 100644
--- a/searx/templates/oscar/base.html
+++ b/searx/templates/oscar/base.html
@@ -85,10 +85,10 @@
{% endblock %}
- {{ _('Powered by') }} searx - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}
- {{ _('Source code') }} |
- {{ _('Issue tracker') }} |
- {{ _('Public instances') }}
+ {{ _('Powered by') }} searx - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}
+ {{ _('Source code') }} |
+ {{ _('Issue tracker') }} |
+ {{ _('Public instances') }}
diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html
index bba02dbf8..b5b184071 100644
--- a/searx/templates/simple/base.html
+++ b/searx/templates/simple/base.html
@@ -51,9 +51,9 @@
diff --git a/searx/webapp.py b/searx/webapp.py
old mode 100644
new mode 100755
index b3928921e..c6b52d6ab
--- 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:
From e84fc94300750c41642bea97d2d9cc020f746c66 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 11:51:03 +0100
Subject: [PATCH 02/25] [fix] brands: add variables from build env to
sphinx-doc
We have some variables in the build environment which are also needed in the
sphinx-process. Theses variables are relavant if one creates a fork with
its own branding. We treat these variables under the term 'brands'.
Signed-off-by: Markus Heiser
---
docs/conf.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
index ebcd102b2..03e977aba 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -4,9 +4,9 @@ import sys, os
from searx.version import VERSION_STRING
from pallets_sphinx_themes import ProjectLink
-GIT_URL = os.environ.get("GIT_URL", "https://github.com/asciimoo/searx")
-SEARX_URL = os.environ.get("SEARX_URL", "https://searx.me")
-DOCS_URL = os.environ.get("DOCS_URL", "https://asciimoo.github.io/searx/")
+from searx.brand import GIT_URL
+from searx.brand import SEARX_URL
+from searx.brand import DOCS_URL
# Project --------------------------------------------------------------
From f6b29f68a107ac083bd5df0d6e7bda8a05f4479f Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 12:03:11 +0100
Subject: [PATCH 03/25] [fix] brands: add variables from build env to setup.py
We have some variables in the build environment which are also needed in the
setup.py process. Theses variables are relavant if one creates a fork with
its own branding. We treat these variables under the term 'brands'.
Signed-off-by: Markus Heiser
---
setup.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index bd3dd5d1c..bd00211b2 100644
--- a/setup.py
+++ b/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()
@@ -36,7 +37,7 @@ setup(
keywords='metasearch searchengine search web http',
author='Adam Tauber',
author_email='asciimoo@gmail.com',
- url='https://github.com/asciimoo/searx',
+ url=brand.GIT_URL,
license='GNU Affero General Public License',
packages=find_packages(exclude=["tests*"]),
zip_safe=False,
From aaf22baad2d0b361e01b8eb2c10de5d03875ecb6 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 12:14:21 +0100
Subject: [PATCH 04/25] make project: re-build generic files of the searx
project
Signed-off-by: Markus Heiser
---
searx/brand.py | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 searx/brand.py
diff --git a/searx/brand.py b/searx/brand.py
new file mode 100644
index 000000000..7cbca7b0f
--- /dev/null
+++ b/searx/brand.py
@@ -0,0 +1,4 @@
+GIT_URL = 'https://github.com/asciimoo/searx'
+SEARX_URL = 'https://searx.me'
+DOCS_URL = 'https://asciimoo.github.io/searx'
+PUBLIC_INSTANCES = 'https://searx.space'
From 757ebb5d9fdc24757f199e52575f32f6faf091b3 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 14:09:47 +0100
Subject: [PATCH 05/25] [fix] brands: add variables from build env to grunt
process
We have some variables in the build environment which are also needed in the
grunt process when building themes. Theses variables are relavant if one
creates a fork with its own branding. We treat these variables under the term
'brands'.
Signed-off-by: Markus Heiser
---
Makefile | 15 +++++++++++++++
docs/dev/quickstart.rst | 6 +++---
manage.sh | 10 ----------
searx/static/themes/oscar/gruntfile.js | 4 +---
searx/static/themes/simple/gruntfile.js | 6 +++---
5 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/Makefile b/Makefile
index 3b2d499e8..4914a309e 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,7 @@ help:
@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 ''
@$(MAKE) -s -f utils/makefile.include make-help
@echo ''
@@ -87,6 +88,20 @@ searx.brand:
$(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
$(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
+# build themes
+# ------------
+
+PHONY += themes themes.oscar themes.simple
+themes: themes.oscar themes.simple
+
+themes.oscar:
+ $(Q)echo '[!] Grunt build : oscar theme'
+ $(Q)grunt --gruntfile "searx/static/themes/oscar/gruntfile.js"
+
+themes.simple:
+ $(Q)echo '[!] Grunt build : simple theme'
+ $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
+
# test
# ----
diff --git a/docs/dev/quickstart.rst b/docs/dev/quickstart.rst
index e40772b3b..cb079a753 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/
@@ -104,7 +104,7 @@ After installing grunt, the files can be built using the following command:
.. code:: sh
- ./manage.sh grunt_build
+ make themes
Tips for debugging/development
diff --git a/manage.sh b/manage.sh
index 496a522ba..0551f02d3 100755
--- a/manage.sh
+++ b/manage.sh
@@ -156,15 +156,6 @@ styles() {
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
@@ -257,7 +248,6 @@ Commands
-----
locales - Compile locales
styles - Build less files
- grunt_build - Build files for themes
docker_build - Build Docker image
Tests
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/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",
From 3dbade0aed048e6001f2ed0f261c7d26f04768ba Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 14:50:39 +0100
Subject: [PATCH 06/25] [fix] brands: add GIT_URL variable to the docker build
Signed-off-by: Markus Heiser
---
Dockerfile | 3 ++-
Makefile | 9 +++++++++
manage.sh | 5 ++---
3 files changed, 13 insertions(+), 4 deletions(-)
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 " \
+LABEL maintainer="searx <${GIT_URL}>" \
description="A privacy-respecting, hackable metasearch engine." \
version="${SEARX_GIT_VERSION}" \
org.label-schema.schema-version="1.0" \
diff --git a/Makefile b/Makefile
index 4914a309e..f81b4e1de 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,7 @@ help:
@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 ''
@$(MAKE) -s -f utils/makefile.include make-help
@echo ''
@@ -102,6 +103,14 @@ themes.simple:
$(Q)echo '[!] Grunt build : simple theme'
$(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
+# docker
+# ------
+
+PHONY += docker
+docker:
+ $(Q)./manage.sh docker_build
+
+
# test
# ----
diff --git a/manage.sh b/manage.sh
index 0551f02d3..bb3fe8831 100755
--- a/manage.sh
+++ b/manage.sh
@@ -202,13 +202,13 @@ 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") \
@@ -248,7 +248,6 @@ Commands
-----
locales - Compile locales
styles - Build less files
- docker_build - Build Docker image
Tests
-----
From 2d12f221a7afbbbaedfb27c5705efd8b94ad6a81 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 15:17:11 +0100
Subject: [PATCH 07/25] [fix] docker build: set build argument LABEL_VCS_URL to
GIT_URL
Signed-off-by: Markus Heiser
---
manage.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/manage.sh b/manage.sh
index bb3fe8831..4c11576a3 100755
--- a/manage.sh
+++ b/manage.sh
@@ -213,7 +213,7 @@ docker_build() {
--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} .
From d471ec86dd72cfae80bdaf72b1ed266b1a8cada7 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 16:38:52 +0100
Subject: [PATCH 08/25] Makefile: add target node.env - download & install npm
dependencies
Signed-off-by: Markus Heiser
---
.gitignore | 3 ++-
Makefile | 23 ++++++++++++++++++++---
docs/dev/quickstart.rst | 2 +-
searx/static/themes/oscar/.gitignore | 3 ++-
searx/static/themes/simple/.gitignore | 2 ++
5 files changed, 27 insertions(+), 6 deletions(-)
create mode 100644 searx/static/themes/simple/.gitignore
diff --git a/.gitignore b/.gitignore
index 069dfd35b..9e08e2a47 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,8 @@ setup.cfg
*/*.pyc
*~
-node_modules/
+/node_modules
+/package-lock.json
.tx/
diff --git a/Makefile b/Makefile
index f81b4e1de..5796ae668 100644
--- a/Makefile
+++ b/Makefile
@@ -30,6 +30,7 @@ help:
@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 ''
@$(MAKE) -s -f utils/makefile.include make-help
@echo ''
@@ -42,7 +43,7 @@ PHONY += uninstall
uninstall: pyenvuninstall
PHONY += clean
-clean: pyclean
+clean: pyclean node.clean
$(call cmd,common_clean)
PHONY += run
@@ -89,6 +90,22 @@ searx.brand:
$(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
$(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
+# 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
# ------------
@@ -97,11 +114,11 @@ themes: themes.oscar themes.simple
themes.oscar:
$(Q)echo '[!] Grunt build : oscar theme'
- $(Q)grunt --gruntfile "searx/static/themes/oscar/gruntfile.js"
+ $(Q)PATH="$$(npm bin):$$PATH" grunt --gruntfile "searx/static/themes/oscar/gruntfile.js"
themes.simple:
$(Q)echo '[!] Grunt build : simple theme'
- $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
+ $(Q)PATH="$$(npm bin):$$PATH" grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
# docker
# ------
diff --git a/docs/dev/quickstart.rst b/docs/dev/quickstart.rst
index cb079a753..a786eda63 100644
--- a/docs/dev/quickstart.rst
+++ b/docs/dev/quickstart.rst
@@ -98,7 +98,7 @@ 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:
diff --git a/searx/static/themes/oscar/.gitignore b/searx/static/themes/oscar/.gitignore
index c2658d7d1..49e0fc6b4 100644
--- a/searx/static/themes/oscar/.gitignore
+++ b/searx/static/themes/oscar/.gitignore
@@ -1 +1,2 @@
-node_modules/
+/node_modules
+/package-lock.json
\ No newline at end of file
diff --git a/searx/static/themes/simple/.gitignore b/searx/static/themes/simple/.gitignore
new file mode 100644
index 000000000..49e0fc6b4
--- /dev/null
+++ b/searx/static/themes/simple/.gitignore
@@ -0,0 +1,2 @@
+/node_modules
+/package-lock.json
\ No newline at end of file
From ace7d30aed0bdff07e97cdb3900c38633877cdcd Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 17:12:02 +0100
Subject: [PATCH 09/25] webapp.py: partial code review (no functional change)
Signed-off-by: Markus Heiser
---
searx/webapp.py | 69 +++++++++++++++++++++++++++++--------------------
1 file changed, 41 insertions(+), 28 deletions(-)
diff --git a/searx/webapp.py b/searx/webapp.py
index c6b52d6ab..3af5c57b4 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -958,34 +958,47 @@ 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,
+ 'doi_resolvers': [r for r in settings['doi_resolvers']],
+ 'default_doi_resolver': settings['default_doi_resolver'],
+ })
@app.errorhandler(404)
From 4d6482823764c840415a6023d945b5699a53ba2a Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 17:28:32 +0100
Subject: [PATCH 10/25] webapp.py: expose the brand variable in the /config
URL.
E.g. helpful for searx-stats2
Signed-off-by: Markus Heiser
---
searx/webapp.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/searx/webapp.py b/searx/webapp.py
index 3af5c57b4..c910230ab 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -996,6 +996,10 @@ def config():
'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'],
})
From 33814719333c2c5b7b13ab47f9c8d4f8a0cecb16 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 17:48:34 +0100
Subject: [PATCH 11/25] brands: add ISSUE_URL
Signed-off-by: Markus Heiser
---
Makefile | 2 ++
searx/brand.py | 1 +
searx/templates/oscar/base.html | 2 +-
searx/templates/simple/base.html | 2 +-
setup.py | 6 +++++-
5 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 5796ae668..bdaa6c774 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
# -*- coding: utf-8; mode: makefile-gmake -*-
export GIT_URL=https://github.com/asciimoo/searx
+export ISSUE_URL=$(GIT_URL)/issues
export SEARX_URL=https://searx.me
export DOCS_URL=https://asciimoo.github.io/searx
@@ -86,6 +87,7 @@ engines-languages: pyenvinstall
searx.brand:
$(Q)echo "build searx/brand.py"
$(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
+ $(Q)echo "ISSUE_URL = '$(ISSUE_URL)'" >> 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
diff --git a/searx/brand.py b/searx/brand.py
index 7cbca7b0f..d563447f6 100644
--- a/searx/brand.py
+++ b/searx/brand.py
@@ -1,4 +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/templates/oscar/base.html b/searx/templates/oscar/base.html
index 4fe335798..5eb4462e4 100644
--- a/searx/templates/oscar/base.html
+++ b/searx/templates/oscar/base.html
@@ -87,7 +87,7 @@
{{ _('Powered by') }} searx - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}
{{ _('Source code') }} |
- {{ _('Issue tracker') }} |
+ {{ _('Issue tracker') }} |
{{ _('Public instances') }}
diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html
index b5b184071..71df123ea 100644
--- a/searx/templates/simple/base.html
+++ b/searx/templates/simple/base.html
@@ -52,7 +52,7 @@
{{ _('Powered by') }} searx - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}
{{ _('Source code') }} |
- {{ _('Issue tracker') }} |
+ {{ _('Issue tracker') }} |
{{ _('Public instances') }}
diff --git a/setup.py b/setup.py
index bd00211b2..97a3270ef 100644
--- a/setup.py
+++ b/setup.py
@@ -26,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",
@@ -37,7 +42,6 @@ setup(
keywords='metasearch searchengine search web http',
author='Adam Tauber',
author_email='asciimoo@gmail.com',
- url=brand.GIT_URL,
license='GNU Affero General Public License',
packages=find_packages(exclude=["tests*"]),
zip_safe=False,
From 3486613a1960f472b9cf8c85ade72c5aec9473eb Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Thu, 26 Mar 2020 10:58:25 +0100
Subject: [PATCH 12/25] brands: hardcode ISSUE_URL and some links on the
about-page
A *brand* of searx is a fork which might have its own design and some special
functions which might bee reasonable in a special context.
In this sense, the fork might have its own documentation but not its own issue
tracker. The *upstream* of a brand is always https://github.com/asciimoo from
where the brand-fork pulls the master branch regularly. A fork which has its
own issue tracker is a spin-off and out of the scope of the searx project
itself. The conclusion is:
- hard code ISSUE_URL (in the Makefile)
- always refer to DOCS_URL
- links in the about page refer to the *upstream* (searx project)
except DOCS_URL
- "fork me on github" ribbons refer to the *upstream*
Signed-off-by: Markus Heiser
---
Makefile | 3 +--
searx/templates/__common__/about.html | 11 +++++------
searx/templates/courgette/github_ribbon.html | 2 +-
searx/templates/legacy/github_ribbon.html | 2 +-
4 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index bdaa6c774..2bea06c9d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,6 @@
# -*- coding: utf-8; mode: makefile-gmake -*-
export GIT_URL=https://github.com/asciimoo/searx
-export ISSUE_URL=$(GIT_URL)/issues
export SEARX_URL=https://searx.me
export DOCS_URL=https://asciimoo.github.io/searx
@@ -87,7 +86,7 @@ engines-languages: pyenvinstall
searx.brand:
$(Q)echo "build searx/brand.py"
$(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
- $(Q)echo "ISSUE_URL = '$(ISSUE_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
diff --git a/searx/templates/__common__/about.html b/searx/templates/__common__/about.html
index d8e1335d9..3f702e63f 100644
--- a/searx/templates/__common__/about.html
+++ b/searx/templates/__common__/about.html
@@ -7,7 +7,7 @@
- searx may not offer you as personalised results as Google, but it doesn't generate a profile about you
- 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
- - searx is free software, the code is 100% open and you can help to make it better. See more on github
+ - searx is free software, the code is 100% open and you can help to make it better. See more on github
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
@@ -22,15 +22,14 @@ Searx can be added to your browser's search bar; moreover, it can be set as the
How can I make it my own?
-Searx appreciates your concern regarding logs, so take the code and run it yourself!
Add your Searx to this list to help other people reclaim their privacy and make the Internet freer!
+
Searx appreciates your concern regarding logs, so take the code and run it yourself!
Add your Searx to this list to help other people reclaim their privacy and make the Internet freer!
The more decentralized the Internet is, the more freedom we have!
More about searx