mirror of
https://github.com/searxng/searxng.git
synced 2024-11-24 03:40:59 +00:00
Merge pull request #584 from kvch/settings-api-call
add config endpoint
This commit is contained in:
commit
be4be8bd9c
1 changed files with 19 additions and 0 deletions
|
@ -49,6 +49,7 @@ from flask import (
|
||||||
redirect, send_from_directory
|
redirect, send_from_directory
|
||||||
)
|
)
|
||||||
from flask.ext.babel import Babel, gettext, format_date
|
from flask.ext.babel import Babel, gettext, format_date
|
||||||
|
from flask.json import jsonify
|
||||||
from searx import settings, searx_dir
|
from searx import settings, searx_dir
|
||||||
from searx.engines import (
|
from searx.engines import (
|
||||||
categories, engines, get_engines_stats, engine_shortcuts
|
categories, engines, get_engines_stats, engine_shortcuts
|
||||||
|
@ -685,6 +686,24 @@ def clear_cookies():
|
||||||
return resp
|
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():
|
def run():
|
||||||
app.run(
|
app.run(
|
||||||
debug=settings['general']['debug'],
|
debug=settings['general']['debug'],
|
||||||
|
|
Loading…
Reference in a new issue