mirror of
https://github.com/searxng/searxng.git
synced 2024-11-22 20:17:45 +01:00
webapp.py: partial code review (no functional change)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
d471ec86dd
commit
ace7d30aed
@ -958,24 +958,37 @@ def clear_cookies():
|
||||
|
||||
@app.route('/config')
|
||||
def config():
|
||||
return jsonify({'categories': list(categories.keys()),
|
||||
'engines': [{'name': name,
|
||||
"""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':
|
||||
list(engine.supported_languages.keys())
|
||||
if isinstance(engine.supported_languages, dict)
|
||||
else engine.supported_languages,
|
||||
'supported_languages': 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],
|
||||
'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'],
|
||||
|
Loading…
Reference in New Issue
Block a user