summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorjibe-b <user701@orange.fr>2017-09-22 23:43:05 +0200
committerNoémi Ványi <sitbackandwait@gmail.com>2017-11-01 14:22:26 +0100
commit575159b194440052d7b48aa073d7e03c80799c90 (patch)
tree693e1db791842058d11c6ddb2cb181bb64b10da3 /searx/webapp.py
parent7de8b43eb2081853ae15b2a52cc0cae43647320b (diff)
downloadsearxng-575159b194440052d7b48aa073d7e03c80799c90.tar.gz
searxng-575159b194440052d7b48aa073d7e03c80799c90.zip
[enh] oa_doi_rewrite plugin broadens doai_rewrite
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index dd93395ee..9542b7814 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -164,6 +164,14 @@ def get_locale():
return locale
+def get_doi_resolver():
+ doi_resolvers = settings['doi_resolvers']
+ doi_resolver = request.args.get('doi_resolver', request.preferences.get_value('doi_resolver'))[0]
+ if doi_resolver not in doi_resolvers:
+ doi_resolvers = settings['default_doi_resolver']
+ return doi_resolver
+
+
# code-highlighter
@app.template_filter('code_highlighter')
def code_highlighter(codelines, language=None):
@@ -695,6 +703,8 @@ def preferences():
shortcuts={y: x for x, y in engine_shortcuts.items()},
themes=themes,
plugins=plugins,
+ doi_resolvers=settings['doi_resolvers'],
+ current_doi_resolver=get_doi_resolver(),
allowed_plugins=allowed_plugins,
theme=get_current_theme_name(),
preferences_url_params=request.preferences.get_as_url_params(),
@@ -839,7 +849,10 @@ def config():
'autocomplete': settings['search']['autocomplete'],
'safe_search': settings['search']['safe_search'],
'default_theme': settings['ui']['default_theme'],
- 'version': VERSION_STRING})
+ 'version': VERSION_STRING,
+ 'doi_resolvers': [r for r in search['doi_resolvers']],
+ 'default_doi_resolver': settings['default_doi_resolver'],
+ })
@app.errorhandler(404)