logo

searx

My custom branche(s) on searx, a meta-search engine
commit: 141b04c6dde9df0e6b7f2e2b30ec8131429c8932
parent: fd6e730d505eabaac6361d23c2d0eb3eab923bcf
Author: asciimoo <asciimoo@gmail.com>
Date:   Thu, 26 Dec 2013 01:53:26 +0100

[enh] optionally configurable hostname - edit settings.py

Diffstat:

Msearx/settings.py2++
Msearx/webapp.py6+++++-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/searx/settings.py b/searx/settings.py @@ -12,3 +12,5 @@ weights = {} # 'search_engine_name': float(weight) | default is 1.0 blacklist = [] # search engine blacklist categories = {} # custom search engine categories + +hostname = None # domain name or None - if you want to rewrite the default HTTP host diff --git a/searx/webapp.py b/searx/webapp.py @@ -165,7 +165,11 @@ def opensearch(): method = 'get' if request.is_secure: scheme = 'https' - ret = opensearch_xml.format(method=method, host=url_for('index', _external=True, _scheme=scheme)) + if settings.hostname: + hostname = '{0}://{1}/'.format(scheme,settings.hostname) + else: + hostname = url_for('index', _external=True, _scheme=scheme) + ret = opensearch_xml.format(method=method, host=hostname) resp = Response(response=ret, status=200, mimetype="application/xml")