From 04c687403e21f883f9614e6a24df9ec450cfc111 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 11:49:33 +0100
Subject: [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
---
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 +++
6 files changed, 19 insertions(+), 16 deletions(-)
mode change 100644 => 100755 searx/webapp.py
(limited to 'searx')
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:
--
cgit v1.2.3
From aaf22baad2d0b361e01b8eb2c10de5d03875ecb6 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 12:14:21 +0100
Subject: 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
(limited to 'searx')
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'
--
cgit v1.2.3
From 757ebb5d9fdc24757f199e52575f32f6faf091b3 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 14:09:47 +0100
Subject: [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
---
searx/static/themes/oscar/gruntfile.js | 4 +---
searx/static/themes/simple/gruntfile.js | 6 +++---
2 files changed, 4 insertions(+), 6 deletions(-)
(limited to 'searx')
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",
--
cgit v1.2.3
From d471ec86dd72cfae80bdaf72b1ed266b1a8cada7 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 16:38:52 +0100
Subject: Makefile: add target node.env - download & install npm dependencies
Signed-off-by: Markus Heiser
---
searx/static/themes/oscar/.gitignore | 3 ++-
searx/static/themes/simple/.gitignore | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
create mode 100644 searx/static/themes/simple/.gitignore
(limited to 'searx')
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
--
cgit v1.2.3
From ace7d30aed0bdff07e97cdb3900c38633877cdcd Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 17:12:02 +0100
Subject: webapp.py: partial code review (no functional change)
Signed-off-by: Markus Heiser
---
searx/webapp.py | 69 ++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 41 insertions(+), 28 deletions(-)
(limited to 'searx')
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)
--
cgit v1.2.3
From 4d6482823764c840415a6023d945b5699a53ba2a Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 17:28:32 +0100
Subject: 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(+)
(limited to 'searx')
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'],
})
--
cgit v1.2.3
From 33814719333c2c5b7b13ab47f9c8d4f8a0cecb16 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Wed, 25 Mar 2020 17:48:34 +0100
Subject: brands: add ISSUE_URL
Signed-off-by: Markus Heiser
---
searx/brand.py | 1 +
searx/templates/oscar/base.html | 2 +-
searx/templates/simple/base.html | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
(limited to 'searx')
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') }}
--
cgit v1.2.3
From 3486613a1960f472b9cf8c85ade72c5aec9473eb Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Thu, 26 Mar 2020 10:58:25 +0100
Subject: 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
---
searx/templates/__common__/about.html | 11 +++++------
searx/templates/courgette/github_ribbon.html | 2 +-
searx/templates/legacy/github_ribbon.html | 2 +-
3 files changed, 7 insertions(+), 8 deletions(-)
(limited to 'searx')
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