From d43d9727a3db8ed99ab7ad4a27cf4f72f8d8b13c Mon Sep 17 00:00:00 2001 From: Noemi Vanyi Date: Tue, 7 Jun 2016 23:08:48 +0200 Subject: [PATCH] [enh] add server_settings call - closes #566 --- searx/webapp.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/searx/webapp.py b/searx/webapp.py index d8289ac0..044f5f45 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'],