packages/searxng: use newer dependencies

This commit is contained in:
Max Headroom 2023-06-06 00:06:16 +02:00
parent 9537724f0c
commit 2e5433a7e7
2 changed files with 1 additions and 46 deletions

View file

@ -11,15 +11,9 @@ toPythonModule (buildPythonApplication rec {
src = npins.mkSource pins.searxng;
patches = [
# wait for https://github.com/NixOS/nixpkgs/pull/211654
./revert-flask-babel-3.0.1.patch
];
postPatch = ''
sed -i \
-e 's/==.*$//' \
-e 's/fasttext-predict/fasttext/g' \
requirements.txt
cat >searx/version_frozen.py <<EOF
VERSION_STRING="${version}"
@ -53,7 +47,7 @@ toPythonModule (buildPythonApplication rec {
httpx
httpx-socks
markdown-it-py
fasttext
fasttext-predict
pybind11
];

View file

@ -1,39 +0,0 @@
--- b/searx/locales.py
+++ a/searx/locales.py
@@ -86,7 +86,7 @@
use_translation = flask.request.form.get('use-translation')
if use_translation in ADDITIONAL_TRANSLATIONS:
babel_ext = flask_babel.current_app.extensions['babel']
+ return Translations.load(next(babel_ext.translation_directories), use_translation)
- return Translations.load(babel_ext.translation_directories[0], use_translation)
return _flask_babel_get_translations()
--- b/searx/webapp.py
+++ a/searx/webapp.py
@@ -160,6 +160,8 @@
app.jinja_env.filters['group_engines_in_tab'] = group_engines_in_tab # pylint: disable=no-member
app.secret_key = settings['server']['secret_key']
+babel = Babel(app)
+
timeout_text = gettext('timeout')
parsing_error_text = gettext('parsing error')
http_protocol_error_text = gettext('HTTP protocol error')
@@ -209,15 +211,13 @@
request = typing.cast(ExtendedRequest, flask.request)
+@babel.localeselector
def get_locale():
locale = localeselector()
logger.debug("%s uses locale `%s`", urllib.parse.quote(request.url), locale)
return locale
-babel = Babel(app, locale_selector=get_locale)
-
-
def _get_browser_language(req, lang_list):
for lang in req.headers.get("Accept-Language", "en").split(","):
if ';' in lang: