summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-06-11 00:46:19 +0200
committerGitHub <noreply@github.com>2016-06-11 00:46:19 +0200
commitbe4be8bd9cad669076b864c2b68c04992a5501ed (patch)
treee436199d5fe91b808a2bde40616c8d2ba21f6fa4
parent1e0381a8d581a57762faa490d4796a00b2dfbf20 (diff)
parentd43d9727a3db8ed99ab7ad4a27cf4f72f8d8b13c (diff)
downloadsearxng-be4be8bd9cad669076b864c2b68c04992a5501ed.tar.gz
searxng-be4be8bd9cad669076b864c2b68c04992a5501ed.zip
Merge pull request #584 from kvch/settings-api-call
add config endpoint
-rw-r--r--searx/webapp.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index d8289ac01..044f5f45c 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -49,6 +49,7 @@ from flask import (
redirect, send_from_directory
)
from flask.ext.babel import Babel, gettext, format_date
+from flask.json import jsonify
from searx import settings, searx_dir
from searx.engines import (
categories, engines, get_engines_stats, engine_shortcuts
@@ -685,6 +686,24 @@ def clear_cookies():
return resp
+@app.route('/config')
+def config():
+ return jsonify({'categories': categories.keys(),
+ 'engines': [{'name': engine_name,
+ 'categories': engine.categories,
+ 'enabled': not engine.disabled}
+ for engine_name, engine in engines.items()],
+ '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']})
+
+
def run():
app.run(
debug=settings['general']['debug'],