mirror of
https://github.com/searxng/searxng.git
synced 2025-08-03 18:42:33 +02:00
Merge pull request #634 from not-my-profile/powered-by
Introduce `categories_as_tabs` & group engines in tabs
This commit is contained in:
commit
aedd6279b3
44 changed files with 247 additions and 105 deletions
|
@ -13,6 +13,7 @@ usage::
|
|||
|
||||
import sys
|
||||
import copy
|
||||
from typing import List
|
||||
|
||||
from os.path import realpath, dirname
|
||||
from babel.localedata import locale_identifiers
|
||||
|
@ -44,7 +45,29 @@ ENGINE_DEFAULT_ARGS = {
|
|||
"display_error_messages": True,
|
||||
"tokens": [],
|
||||
}
|
||||
"""Defaults for the namespace of an engine module, see :py:func:`load_engine`"""
|
||||
# set automatically when an engine does not have any tab category
|
||||
OTHER_CATEGORY = 'other'
|
||||
|
||||
|
||||
class Engine: # pylint: disable=too-few-public-methods
|
||||
"""This class is currently never initialized and only used for type hinting."""
|
||||
|
||||
name: str
|
||||
engine: str
|
||||
shortcut: str
|
||||
categories: List[str]
|
||||
supported_languages: List[str]
|
||||
about: dict
|
||||
inactive: bool
|
||||
disabled: bool
|
||||
language_support: bool
|
||||
paging: bool
|
||||
safesearch: bool
|
||||
time_range_support: bool
|
||||
timeout: float
|
||||
|
||||
|
||||
# Defaults for the namespace of an engine module, see :py:func:`load_engine``
|
||||
|
||||
categories = {'general': []}
|
||||
engines = {}
|
||||
|
@ -113,6 +136,9 @@ def load_engine(engine_data):
|
|||
|
||||
set_loggers(engine, engine_name)
|
||||
|
||||
if not any(cat in settings['categories_as_tabs'] for cat in engine.categories):
|
||||
engine.categories.append(OTHER_CATEGORY)
|
||||
|
||||
return engine
|
||||
|
||||
|
||||
|
@ -138,6 +164,8 @@ def update_engine_attributes(engine, engine_data):
|
|||
if isinstance(param_value, str):
|
||||
param_value = list(map(str.strip, param_value.split(',')))
|
||||
engine.categories = param_value
|
||||
elif hasattr(engine, 'about') and param_name == 'about':
|
||||
engine.about = {**engine.about, **engine_data['about']}
|
||||
else:
|
||||
setattr(engine, param_name, param_value)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['files']
|
||||
categories = ['files', 'apps']
|
||||
paging = True
|
||||
time_range_support = False
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['it']
|
||||
categories = ['it', 'software wikis']
|
||||
paging = True
|
||||
base_url = 'https://wiki.archlinux.org'
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['general']
|
||||
categories = ['general', 'web']
|
||||
paging = True
|
||||
time_range_support = False
|
||||
safesearch = False
|
||||
|
|
|
@ -27,7 +27,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['images']
|
||||
categories = ['images', 'web']
|
||||
paging = True
|
||||
safesearch = True
|
||||
time_range_support = True
|
||||
|
|
|
@ -26,7 +26,7 @@ about = {
|
|||
"results": 'HTML',
|
||||
}
|
||||
|
||||
categories = ['videos']
|
||||
categories = ['videos', 'web']
|
||||
paging = True
|
||||
safesearch = True
|
||||
time_range_support = True
|
||||
|
|
|
@ -27,7 +27,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['general']
|
||||
categories = ['general', 'web']
|
||||
paging = True
|
||||
supported_languages_url = 'https://duckduckgo.com/util/u588.js'
|
||||
time_range_support = True
|
||||
|
|
|
@ -27,7 +27,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['images']
|
||||
categories = ['images', 'web']
|
||||
paging = True
|
||||
safesearch = True
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ about = {
|
|||
"language": 'de',
|
||||
}
|
||||
|
||||
categories = ['general']
|
||||
categories = ['dictionaries']
|
||||
paging = True
|
||||
|
||||
# search-url
|
||||
|
|
|
@ -17,7 +17,7 @@ about = {
|
|||
"results": 'HTML',
|
||||
}
|
||||
|
||||
categories = ['general']
|
||||
categories = ['general', 'web']
|
||||
paging = False
|
||||
safesearch = True
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['files']
|
||||
categories = ['files', 'apps']
|
||||
paging = True
|
||||
|
||||
# search-url
|
||||
|
|
|
@ -20,7 +20,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['music']
|
||||
categories = ['music', 'lyrics']
|
||||
paging = True
|
||||
page_size = 5
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['it']
|
||||
categories = ['it', 'software wikis']
|
||||
paging = True
|
||||
base_url = 'https://wiki.gentoo.org'
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['general']
|
||||
categories = ['general', 'web']
|
||||
# gigablast's pagination is totally damaged, don't use it
|
||||
paging = False
|
||||
safesearch = True
|
||||
|
|
|
@ -17,7 +17,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['it']
|
||||
categories = ['it', 'repos']
|
||||
|
||||
# search-url
|
||||
search_url = 'https://api.github.com/search/repositories?sort=stars&order=desc&{query}' # noqa
|
||||
|
|
|
@ -41,7 +41,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['general']
|
||||
categories = ['general', 'web']
|
||||
paging = True
|
||||
time_range_support = True
|
||||
safesearch = True
|
||||
|
|
|
@ -45,7 +45,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['images']
|
||||
categories = ['images', 'web']
|
||||
paging = False
|
||||
use_locale_domain = True
|
||||
time_range_support = True
|
||||
|
|
|
@ -54,7 +54,7 @@ about = {
|
|||
|
||||
# engine dependent config
|
||||
|
||||
categories = ['videos']
|
||||
categories = ['videos', 'web']
|
||||
paging = False
|
||||
language_support = True
|
||||
use_locale_domain = True
|
||||
|
|
|
@ -27,9 +27,7 @@ about = {
|
|||
"results": 'HTML',
|
||||
}
|
||||
|
||||
categories = [
|
||||
'general',
|
||||
]
|
||||
categories = []
|
||||
paging = False
|
||||
|
||||
# suggestion_url = "https://sg.media-imdb.com/suggestion/{letter}/{query}.json"
|
||||
|
|
|
@ -25,6 +25,7 @@ about = {
|
|||
"language": "cz",
|
||||
}
|
||||
|
||||
categories = ['general', 'web']
|
||||
base_url = 'https://search.seznam.cz/'
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ about = {
|
|||
"language": 'pl',
|
||||
}
|
||||
|
||||
categories = ['general']
|
||||
categories = ['dictionaries']
|
||||
paging = False
|
||||
|
||||
URL = 'https://sjp.pwn.pl'
|
||||
|
|
|
@ -23,7 +23,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['general']
|
||||
categories = ['general', 'web']
|
||||
# there is a mechanism to block "bot" search
|
||||
# (probably the parameter qid), require
|
||||
# storing of qid's between mulitble search-calls
|
||||
|
|
|
@ -14,7 +14,7 @@ about = {
|
|||
}
|
||||
|
||||
engine_type = 'online_dictionary'
|
||||
categories = ['general']
|
||||
categories = ['dictionaries']
|
||||
url = 'https://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'
|
||||
web_url = 'https://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'
|
||||
weight = 100
|
||||
|
|
|
@ -31,7 +31,7 @@ about = {
|
|||
}
|
||||
|
||||
# engine dependent config
|
||||
categories = ['general']
|
||||
categories = ['general', 'web']
|
||||
paging = True
|
||||
time_range_support = True
|
||||
supported_languages_url = 'https://search.yahoo.com/preferences/languages'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue