mirror of
https://github.com/searxng/searxng.git
synced 2024-11-22 20:17:45 +01:00
more follow ups in new preferences
This commit is contained in:
parent
8c4db08443
commit
5867e97966
@ -227,8 +227,7 @@ class Search(object):
|
|||||||
# using user-defined default-configuration which
|
# using user-defined default-configuration which
|
||||||
# (is stored in cookie)
|
# (is stored in cookie)
|
||||||
if not self.categories:
|
if not self.categories:
|
||||||
cookie_categories = request.cookies.get('categories', '')
|
cookie_categories = request.preferences.get_value('categories')
|
||||||
cookie_categories = cookie_categories.split(',')
|
|
||||||
for ccateg in cookie_categories:
|
for ccateg in cookie_categories:
|
||||||
if ccateg in categories:
|
if ccateg in categories:
|
||||||
self.categories.append(ccateg)
|
self.categories.append(ccateg)
|
||||||
|
@ -128,11 +128,8 @@ outgoing_proxies = settings['outgoing'].get('proxies', None)
|
|||||||
def get_locale():
|
def get_locale():
|
||||||
locale = request.accept_languages.best_match(settings['locales'].keys())
|
locale = request.accept_languages.best_match(settings['locales'].keys())
|
||||||
|
|
||||||
if settings['ui'].get('default_locale'):
|
if request.preferences.get_value('locale') != '':
|
||||||
locale = settings['ui']['default_locale']
|
locale = request.preferences.get_value('locale')
|
||||||
|
|
||||||
if request.cookies.get('locale', '') in settings['locales']:
|
|
||||||
locale = request.cookies.get('locale', '')
|
|
||||||
|
|
||||||
if 'locale' in request.args\
|
if 'locale' in request.args\
|
||||||
and request.args['locale'] in settings['locales']:
|
and request.args['locale'] in settings['locales']:
|
||||||
@ -248,7 +245,7 @@ def image_proxify(url):
|
|||||||
if url.startswith('//'):
|
if url.startswith('//'):
|
||||||
url = 'https:' + url
|
url = 'https:' + url
|
||||||
|
|
||||||
if not settings['server'].get('image_proxy') and not request.cookies.get('image_proxy'):
|
if not request.preferences.get_value('image_proxy'):
|
||||||
return url
|
return url
|
||||||
|
|
||||||
hash_string = url + settings['server']['secret_key']
|
hash_string = url + settings['server']['secret_key']
|
||||||
@ -289,14 +286,13 @@ def render(template_name, override_theme=None, **kwargs):
|
|||||||
if not kwargs['selected_categories']:
|
if not kwargs['selected_categories']:
|
||||||
cookie_categories = request.preferences.get_value('categories')
|
cookie_categories = request.preferences.get_value('categories')
|
||||||
for ccateg in cookie_categories:
|
for ccateg in cookie_categories:
|
||||||
if ccateg in categories:
|
kwargs['selected_categories'].append(ccateg)
|
||||||
kwargs['selected_categories'].append(ccateg)
|
|
||||||
|
|
||||||
if not kwargs['selected_categories']:
|
if not kwargs['selected_categories']:
|
||||||
kwargs['selected_categories'] = ['general']
|
kwargs['selected_categories'] = ['general']
|
||||||
|
|
||||||
if 'autocomplete' not in kwargs:
|
if 'autocomplete' not in kwargs:
|
||||||
kwargs['autocomplete'] = autocomplete
|
kwargs['autocomplete'] = request.preferences.get_value('autocomplete')
|
||||||
|
|
||||||
if get_locale() in rtl_locales and 'rtl' not in kwargs:
|
if get_locale() in rtl_locales and 'rtl' not in kwargs:
|
||||||
kwargs['rtl'] = True
|
kwargs['rtl'] = True
|
||||||
@ -501,7 +497,7 @@ def autocompleter():
|
|||||||
# normal autocompletion results only appear if max 3 inner results returned
|
# normal autocompletion results only appear if max 3 inner results returned
|
||||||
if len(raw_results) <= 3 and completer:
|
if len(raw_results) <= 3 and completer:
|
||||||
# get language from cookie
|
# get language from cookie
|
||||||
language = request.cookies.get('language')
|
language = request.preferences.get_value('language')
|
||||||
if not language or language == 'all':
|
if not language or language == 'all':
|
||||||
language = 'en'
|
language = 'en'
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user