[enh] show categories not in any tab category in "Other" preferences tab

Previously we didn't have a good place to put search engines that don't
fit into any of the tab categories. This commit automatically puts
search engines that don't belong to any tab category in an "other"
category, that is only displayed in the user preferences (and not above
search results).
This commit is contained in:
Martin Fischer 2021-12-28 16:12:54 +01:00
parent 4ac6b5d32d
commit ab90e2ac49
4 changed files with 13 additions and 4 deletions

View file

@ -59,6 +59,7 @@ from searx.settings_defaults import OUTPUT_FORMATS
from searx.settings_loader import get_default_settings_path
from searx.exceptions import SearxParameterException
from searx.engines import (
OTHER_CATEGORY,
DEFAULT_GROUP_NAME,
categories,
engines,
@ -182,6 +183,7 @@ _category_names = (
gettext('software wikis'),
gettext('web'),
gettext(DEFAULT_GROUP_NAME),
gettext(OTHER_CATEGORY),
)
_simple_style = (gettext('auto'), gettext('light'), gettext('dark'))
@ -439,6 +441,7 @@ def render(template_name, override_theme=None, **kwargs):
kwargs['theme'] = get_current_theme_name(override=override_theme)
kwargs['categories_as_tabs'] = settings['categories_as_tabs']
kwargs['categories'] = _get_enable_categories(categories.keys())
kwargs['OTHER_CATEGORY'] = OTHER_CATEGORY
# i18n
kwargs['language_codes'] = [l for l in languages if l[0] in settings['search']['languages']]