mirror of https://github.com/searxng/searxng.git
Compare commits
6 Commits
259fcdd873
...
92b59e2645
Author | SHA1 | Date |
---|---|---|
Bnyro | 92b59e2645 | |
Bnyro | b07c0ae39f | |
Markus Heiser | 56e3d72a76 | |
searxng-bot | cc148a76b0 | |
uply23333 | fa108c140f | |
Bnyro | 443fcc7233 |
|
@ -45,14 +45,6 @@ jobs:
|
|||
make V=1 gecko.driver
|
||||
- name: Run tests
|
||||
run: make V=1 ci.test
|
||||
- name: Test coverage
|
||||
run: make V=1 test.coverage
|
||||
- name: Store coverage result
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: coverage-${{ matrix.python-version }}
|
||||
path: coverage/
|
||||
retention-days: 60
|
||||
|
||||
themes:
|
||||
name: Themes
|
||||
|
|
|
@ -34,10 +34,10 @@ Implementations
|
|||
"""
|
||||
|
||||
from typing import List, Dict, Any, Optional
|
||||
from urllib.parse import quote
|
||||
from urllib.parse import urlencode
|
||||
from lxml import html
|
||||
|
||||
from searx.utils import extract_text, eval_xpath, eval_xpath_list
|
||||
from searx.utils import extract_text, eval_xpath, eval_xpath_getindex, eval_xpath_list
|
||||
from searx.enginelib.traits import EngineTraits
|
||||
from searx.data import ENGINE_TRAITS
|
||||
|
||||
|
@ -53,7 +53,7 @@ about: Dict[str, Any] = {
|
|||
|
||||
# engine dependent config
|
||||
categories: List[str] = ["files"]
|
||||
paging: bool = False
|
||||
paging: bool = True
|
||||
|
||||
# search-url
|
||||
base_url: str = "https://annas-archive.org"
|
||||
|
@ -99,9 +99,18 @@ def init(engine_settings=None): # pylint: disable=unused-argument
|
|||
|
||||
|
||||
def request(query, params: Dict[str, Any]) -> Dict[str, Any]:
|
||||
q = quote(query)
|
||||
lang = traits.get_language(params["language"], traits.all_locale) # type: ignore
|
||||
params["url"] = base_url + f"/search?lang={lang or ''}&content={aa_content}&ext={aa_ext}&sort={aa_sort}&q={q}"
|
||||
args = {
|
||||
'lang': lang,
|
||||
'content': aa_content,
|
||||
'ext': aa_ext,
|
||||
'sort': aa_sort,
|
||||
'q': query,
|
||||
'page': params['pageno'],
|
||||
}
|
||||
# filter out None and empty values
|
||||
filtered_args = dict((k, v) for k, v in args.items() if v)
|
||||
params["url"] = f"{base_url}/search?{urlencode(filtered_args)}"
|
||||
return params
|
||||
|
||||
|
||||
|
@ -128,12 +137,12 @@ def response(resp) -> List[Dict[str, Optional[str]]]:
|
|||
def _get_result(item):
|
||||
return {
|
||||
'template': 'paper.html',
|
||||
'url': base_url + item.xpath('./@href')[0],
|
||||
'url': base_url + extract_text(eval_xpath_getindex(item, './@href', 0)),
|
||||
'title': extract_text(eval_xpath(item, './/h3/text()[1]')),
|
||||
'publisher': extract_text(eval_xpath(item, './/div[contains(@class, "text-sm")]')),
|
||||
'authors': [extract_text(eval_xpath(item, './/div[contains(@class, "italic")]'))],
|
||||
'content': extract_text(eval_xpath(item, './/div[contains(@class, "text-xs")]')),
|
||||
'thumbnail': item.xpath('.//img/@src')[0],
|
||||
'thumbnail': extract_text(eval_xpath_getindex(item, './/img/@src', 0, default=None), allow_none=True),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ filter_mapping = {0: 'off', 1: 'medium', 2: 'high'}
|
|||
results_xpath = './/div[contains(@jscontroller, "SC7lYd")]'
|
||||
title_xpath = './/a/h3[1]'
|
||||
href_xpath = './/a[h3]/@href'
|
||||
content_xpath = './/div[@data-sncf="1"]'
|
||||
content_xpath = './/div[contains(@data-sncf, "1")]'
|
||||
|
||||
# Suggestions are links placed in a *card-section*, we extract only the text
|
||||
# from the links not the links itself.
|
||||
|
|
|
@ -8,6 +8,7 @@ from timeit import default_timer
|
|||
from operator import itemgetter
|
||||
|
||||
from searx.engines import engines
|
||||
from searx.openmetrics import OpenMetricsFamily
|
||||
from .models import HistogramStorage, CounterStorage, VoidHistogram, VoidCounterStorage
|
||||
from .error_recorder import count_error, count_exception, errors_per_engines
|
||||
|
||||
|
@ -149,7 +150,9 @@ def get_reliabilities(engline_name_list, checker_results):
|
|||
checker_result = checker_results.get(engine_name, {})
|
||||
checker_success = checker_result.get('success', True)
|
||||
errors = engine_errors.get(engine_name) or []
|
||||
if counter('engine', engine_name, 'search', 'count', 'sent') == 0:
|
||||
sent_count = counter('engine', engine_name, 'search', 'count', 'sent')
|
||||
|
||||
if sent_count == 0:
|
||||
# no request
|
||||
reliability = None
|
||||
elif checker_success and not errors:
|
||||
|
@ -164,8 +167,9 @@ def get_reliabilities(engline_name_list, checker_results):
|
|||
|
||||
reliabilities[engine_name] = {
|
||||
'reliability': reliability,
|
||||
'sent_count': sent_count,
|
||||
'errors': errors,
|
||||
'checker': checker_results.get(engine_name, {}).get('errors', {}),
|
||||
'checker': checker_result.get('errors', {}),
|
||||
}
|
||||
return reliabilities
|
||||
|
||||
|
@ -245,3 +249,53 @@ def get_engines_stats(engine_name_list):
|
|||
'max_time': math.ceil(max_time_total or 0),
|
||||
'max_result_count': math.ceil(max_result_count or 0),
|
||||
}
|
||||
|
||||
|
||||
def openmetrics(engine_stats, engine_reliabilities):
|
||||
metrics = [
|
||||
OpenMetricsFamily(
|
||||
key="searxng_engines_response_time_total_seconds",
|
||||
type_hint="gauge",
|
||||
help_hint="The average total response time of the engine",
|
||||
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
|
||||
data=[engine['total'] for engine in engine_stats['time']],
|
||||
),
|
||||
OpenMetricsFamily(
|
||||
key="searxng_engines_response_time_processing_seconds",
|
||||
type_hint="gauge",
|
||||
help_hint="The average processing response time of the engine",
|
||||
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
|
||||
data=[engine['processing'] for engine in engine_stats['time']],
|
||||
),
|
||||
OpenMetricsFamily(
|
||||
key="searxng_engines_response_time_http_seconds",
|
||||
type_hint="gauge",
|
||||
help_hint="The average HTTP response time of the engine",
|
||||
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
|
||||
data=[engine['http'] for engine in engine_stats['time']],
|
||||
),
|
||||
OpenMetricsFamily(
|
||||
key="searxng_engines_result_count_total",
|
||||
type_hint="counter",
|
||||
help_hint="The total amount of results returned by the engine",
|
||||
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
|
||||
data=[engine['result_count'] for engine in engine_stats['time']],
|
||||
),
|
||||
OpenMetricsFamily(
|
||||
key="searxng_engines_request_count_total",
|
||||
type_hint="counter",
|
||||
help_hint="The total amount of user requests made to this engine",
|
||||
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
|
||||
data=[engine_reliabilities.get(engine['name'], {}).get('sent_count', 0) for engine in engine_stats['time']],
|
||||
),
|
||||
OpenMetricsFamily(
|
||||
key="searxng_engines_reliability_total",
|
||||
type_hint="counter",
|
||||
help_hint="The overall reliability of the engine",
|
||||
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
|
||||
data=[
|
||||
engine_reliabilities.get(engine['name'], {}).get('reliability', 0) for engine in engine_stats['time']
|
||||
],
|
||||
),
|
||||
]
|
||||
return "".join([str(metric) for metric in metrics])
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
"""Module providing support for displaying data in OpenMetrics format"""
|
||||
|
||||
|
||||
class OpenMetricsFamily: # pylint: disable=too-few-public-methods
|
||||
"""A family of metrics.
|
||||
The key parameter is the metric name that should be used (snake case).
|
||||
The type_hint parameter must be one of 'counter', 'gauge', 'histogram', 'summary'.
|
||||
The help_hint parameter is a short string explaining the metric.
|
||||
The data_info parameter is a dictionary of descriptionary parameters for the data point (e.g. request method/path).
|
||||
The data parameter is a flat list of the actual data in shape of a primive type.
|
||||
|
||||
See https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md for more information.
|
||||
"""
|
||||
|
||||
def __init__(self, key: str, type_hint: str, help_hint: str, data_info: list, data: list):
|
||||
self.key = key
|
||||
self.type_hint = type_hint
|
||||
self.help_hint = help_hint
|
||||
self.data_info = data_info
|
||||
self.data = data
|
||||
|
||||
def __str__(self):
|
||||
text_representation = f"""# HELP {self.key} {self.help_hint}
|
||||
# TYPE {self.key} {self.type_hint}
|
||||
"""
|
||||
|
||||
for i in range(0, len(self.data_info)):
|
||||
if not self.data[i] and self.data[i] != 0:
|
||||
continue
|
||||
|
||||
info_representation = ','.join([f"{key}=\"{value}\"" for (key, value) in self.data_info[i].items()])
|
||||
text_representation += f"{self.key}{{{info_representation}}} {self.data[i]}\n"
|
||||
|
||||
return text_representation
|
|
@ -12,6 +12,10 @@ general:
|
|||
contact_url: false
|
||||
# record stats
|
||||
enable_metrics: true
|
||||
# expose stats in open metrics format at /metrics
|
||||
# leave empty to disable (no password set)
|
||||
# open_metrics: <password>
|
||||
open_metrics: ''
|
||||
|
||||
brand:
|
||||
new_issue_url: https://github.com/searxng/searxng/issues/new
|
||||
|
|
|
@ -143,6 +143,7 @@ SCHEMA = {
|
|||
'contact_url': SettingsValue((None, False, str), None),
|
||||
'donation_url': SettingsValue((bool, str), "https://docs.searxng.org/donate.html"),
|
||||
'enable_metrics': SettingsValue(bool, True),
|
||||
'open_metrics': SettingsValue(str, ''),
|
||||
},
|
||||
'brand': {
|
||||
'issue_url': SettingsValue(str, 'https://github.com/searxng/searxng/issues'),
|
||||
|
|
Binary file not shown.
|
@ -39,7 +39,7 @@ msgstr ""
|
|||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||
"PO-Revision-Date: 2024-10-06 14:31+0000\n"
|
||||
"PO-Revision-Date: 2024-10-26 21:13+0000\n"
|
||||
"Last-Translator: Atul_Eterno <Atul_Eterno@users.noreply.translate.codeberg."
|
||||
"org>\n"
|
||||
"Language-Team: Spanish <https://translate.codeberg.org/projects/searxng/"
|
||||
|
@ -49,7 +49,7 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 5.7.2\n"
|
||||
"X-Generator: Weblate 5.8.1\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
@ -155,7 +155,7 @@ msgstr "preguntas y respuestas"
|
|||
#. CATEGORY_GROUPS['REPOS']
|
||||
#: searx/searxng.msg
|
||||
msgid "repos"
|
||||
msgstr "repos"
|
||||
msgstr "repositorios"
|
||||
|
||||
#. CATEGORY_GROUPS['SOFTWARE_WIKIS']
|
||||
#: searx/searxng.msg
|
||||
|
|
Binary file not shown.
|
@ -22,13 +22,14 @@
|
|||
# MVDW-Java <MVDW-Java@users.noreply.translate.codeberg.org>, 2024.
|
||||
# notlmutsaers <notlmutsaers@users.noreply.translate.codeberg.org>, 2024.
|
||||
# return42 <return42@users.noreply.translate.codeberg.org>, 2024.
|
||||
# ljansen <ljansen@users.noreply.translate.codeberg.org>, 2024.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||
"PO-Revision-Date: 2024-10-15 12:18+0000\n"
|
||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
||||
"PO-Revision-Date: 2024-10-28 21:07+0000\n"
|
||||
"Last-Translator: ljansen <ljansen@users.noreply.translate.codeberg.org>\n"
|
||||
"Language-Team: Dutch <https://translate.codeberg.org/projects/searxng/"
|
||||
"searxng/nl/>\n"
|
||||
"Language: nl\n"
|
||||
|
@ -36,7 +37,7 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 5.7.2\n"
|
||||
"X-Generator: Weblate 5.8.1\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
@ -464,7 +465,7 @@ msgstr "Bereken {functions} van de opties"
|
|||
|
||||
#: searx/engines/mozhi.py:57
|
||||
msgid "Synonyms"
|
||||
msgstr ""
|
||||
msgstr "Synoniemen"
|
||||
|
||||
#: searx/engines/openstreetmap.py:159
|
||||
msgid "Get directions"
|
||||
|
@ -1234,12 +1235,13 @@ msgid "Max time"
|
|||
msgstr "Max. duur"
|
||||
|
||||
#: searx/templates/simple/preferences/favicon.html:2
|
||||
#, fuzzy
|
||||
msgid "Favicon Resolver"
|
||||
msgstr ""
|
||||
msgstr "favicon-resolver"
|
||||
|
||||
#: searx/templates/simple/preferences/favicon.html:15
|
||||
msgid "Display favicons near search results"
|
||||
msgstr ""
|
||||
msgstr "Vertoon zoekresultaten naast favicons"
|
||||
|
||||
#: searx/templates/simple/preferences/footer.html:2
|
||||
msgid ""
|
||||
|
|
Binary file not shown.
|
@ -23,8 +23,8 @@ msgstr ""
|
|||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||
"PO-Revision-Date: 2024-10-15 12:18+0000\n"
|
||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
||||
"PO-Revision-Date: 2024-10-28 21:07+0000\n"
|
||||
"Last-Translator: Eryk Michalak <gnu.ewm@protonmail.com>\n"
|
||||
"Language-Team: Polish <https://translate.codeberg.org/projects/searxng/"
|
||||
"searxng/pl/>\n"
|
||||
"Language: pl\n"
|
||||
|
@ -34,7 +34,7 @@ msgstr ""
|
|||
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && ("
|
||||
"n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && "
|
||||
"n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
|
||||
"X-Generator: Weblate 5.7.2\n"
|
||||
"X-Generator: Weblate 5.8.1\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
@ -1230,7 +1230,7 @@ msgstr "Maksymalny czas"
|
|||
|
||||
#: searx/templates/simple/preferences/favicon.html:2
|
||||
msgid "Favicon Resolver"
|
||||
msgstr ""
|
||||
msgstr "Pobieranie favikony"
|
||||
|
||||
#: searx/templates/simple/preferences/favicon.html:15
|
||||
msgid "Display favicons near search results"
|
||||
|
|
Binary file not shown.
|
@ -19,13 +19,14 @@
|
|||
# gvlx <gvlx@users.noreply.translate.codeberg.org>, 2024.
|
||||
# ds451 <ds451@users.noreply.translate.codeberg.org>, 2024.
|
||||
# Pedro_Tresp <Pedro_Tresp@users.noreply.translate.codeberg.org>, 2024.
|
||||
# saltsnorter <saltsnorter@users.noreply.translate.codeberg.org>, 2024.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||
"PO-Revision-Date: 2024-10-13 23:26+0000\n"
|
||||
"Last-Translator: Pedro_Tresp <Pedro_Tresp@users.noreply.translate.codeberg."
|
||||
"PO-Revision-Date: 2024-10-29 05:54+0000\n"
|
||||
"Last-Translator: saltsnorter <saltsnorter@users.noreply.translate.codeberg."
|
||||
"org>\n"
|
||||
"Language-Team: Portuguese <https://translate.codeberg.org/projects/searxng/"
|
||||
"searxng/pt/>\n"
|
||||
|
@ -34,7 +35,7 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Weblate 5.7.2\n"
|
||||
"X-Generator: Weblate 5.8.1\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
@ -175,7 +176,7 @@ msgstr "escuro"
|
|||
#. STYLE_NAMES['BLACK']
|
||||
#: searx/searxng.msg
|
||||
msgid "black"
|
||||
msgstr ""
|
||||
msgstr "preto"
|
||||
|
||||
#. BRAND_CUSTOM_LINKS['UPTIME']
|
||||
#: searx/searxng.msg
|
||||
|
@ -1228,11 +1229,11 @@ msgstr "Tempo máximo"
|
|||
|
||||
#: searx/templates/simple/preferences/favicon.html:2
|
||||
msgid "Favicon Resolver"
|
||||
msgstr ""
|
||||
msgstr "Solucionador do Favicon"
|
||||
|
||||
#: searx/templates/simple/preferences/favicon.html:15
|
||||
msgid "Display favicons near search results"
|
||||
msgstr ""
|
||||
msgstr "Monstra os favicons nos proximos os resultados"
|
||||
|
||||
#: searx/templates/simple/preferences/footer.html:2
|
||||
msgid ""
|
||||
|
|
Binary file not shown.
|
@ -30,13 +30,14 @@
|
|||
# Pyrbor <Pyrbor@users.noreply.translate.codeberg.org>, 2024.
|
||||
# rodgui <rodgui@users.noreply.translate.codeberg.org>, 2024.
|
||||
# rafablog77 <rafablog77@users.noreply.translate.codeberg.org>, 2024.
|
||||
# Juno Takano <jutty@users.noreply.translate.codeberg.org>, 2024.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||
"PO-Revision-Date: 2024-10-15 12:18+0000\n"
|
||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
||||
"PO-Revision-Date: 2024-10-31 12:16+0000\n"
|
||||
"Last-Translator: Juno Takano <jutty@users.noreply.translate.codeberg.org>\n"
|
||||
"Language-Team: Portuguese (Brazil) <https://translate.codeberg.org/projects/"
|
||||
"searxng/searxng/pt_BR/>\n"
|
||||
"Language: pt_BR\n"
|
||||
|
@ -44,7 +45,7 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n > 1;\n"
|
||||
"X-Generator: Weblate 5.7.2\n"
|
||||
"X-Generator: Weblate 5.8.1\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
@ -185,7 +186,7 @@ msgstr "escuro"
|
|||
#. STYLE_NAMES['BLACK']
|
||||
#: searx/searxng.msg
|
||||
msgid "black"
|
||||
msgstr ""
|
||||
msgstr "preto"
|
||||
|
||||
#. BRAND_CUSTOM_LINKS['UPTIME']
|
||||
#: searx/searxng.msg
|
||||
|
@ -472,7 +473,7 @@ msgstr "Computar {functions} dos argumentos"
|
|||
|
||||
#: searx/engines/mozhi.py:57
|
||||
msgid "Synonyms"
|
||||
msgstr ""
|
||||
msgstr "Sinônimos"
|
||||
|
||||
#: searx/engines/openstreetmap.py:159
|
||||
msgid "Get directions"
|
||||
|
@ -1243,7 +1244,7 @@ msgstr "Tempo máximo"
|
|||
|
||||
#: searx/templates/simple/preferences/favicon.html:2
|
||||
msgid "Favicon Resolver"
|
||||
msgstr ""
|
||||
msgstr "Resolvedor de Favicons"
|
||||
|
||||
#: searx/templates/simple/preferences/favicon.html:15
|
||||
msgid "Display favicons near search results"
|
||||
|
|
Binary file not shown.
|
@ -12,19 +12,19 @@
|
|||
# tvminh19 <tvminh19@users.noreply.translate.codeberg.org>, 2024.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: searx\n"
|
||||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||
"PO-Revision-Date: 2024-08-07 01:02+0000\n"
|
||||
"Last-Translator: tvminh19 <tvminh19@users.noreply.translate.codeberg.org>"
|
||||
"\n"
|
||||
"PO-Revision-Date: 2024-10-26 21:13+0000\n"
|
||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
||||
"Language-Team: Vietnamese <https://translate.codeberg.org/projects/searxng/"
|
||||
"searxng/vi/>\n"
|
||||
"Language: vi\n"
|
||||
"Language-Team: Vietnamese "
|
||||
"<https://translate.codeberg.org/projects/searxng/searxng/vi/>\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 5.8.1\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
@ -186,7 +186,7 @@ msgstr "Nhiệt độ trung bình."
|
|||
#. WEATHER_TERMS['CLOUD COVER']
|
||||
#: searx/engines/open_meteo.py:91 searx/searxng.msg
|
||||
msgid "Cloud cover"
|
||||
msgstr ""
|
||||
msgstr "Mây che phủ"
|
||||
|
||||
#. WEATHER_TERMS['CONDITION']
|
||||
#: searx/engines/duckduckgo_weather.py:45 searx/engines/wttr.py:51
|
||||
|
@ -283,7 +283,7 @@ msgstr ""
|
|||
#: searx/engines/duckduckgo_weather.py:58 searx/engines/open_meteo.py:86
|
||||
#: searx/engines/wttr.py:62 searx/searxng.msg
|
||||
msgid "Wind"
|
||||
msgstr ""
|
||||
msgstr "Gió"
|
||||
|
||||
#. SOCIAL_MEDIA_TERMS['SUBSCRIBERS']
|
||||
#: searx/engines/lemmy.py:85 searx/searxng.msg
|
||||
|
@ -1990,4 +1990,3 @@ msgstr "ẩn phim"
|
|||
|
||||
#~ msgid "Engines cannot retrieve results"
|
||||
#~ msgstr "Các trình tìm kiếm không nhận được kết quả"
|
||||
|
||||
|
|
Binary file not shown.
|
@ -28,18 +28,19 @@
|
|||
# hugoalh <hugoalh@users.noreply.translate.codeberg.org>, 2024.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: searx\n"
|
||||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||
"PO-Revision-Date: 2024-08-12 04:00+0000\n"
|
||||
"Last-Translator: hugoalh <hugoalh@users.noreply.translate.codeberg.org>\n"
|
||||
"PO-Revision-Date: 2024-10-26 21:13+0000\n"
|
||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
||||
"Language-Team: Chinese (Traditional Han script) <https://translate.codeberg."
|
||||
"org/projects/searxng/searxng/zh_Hant/>\n"
|
||||
"Language: zh_Hant_TW\n"
|
||||
"Language-Team: Chinese (Traditional) "
|
||||
"<https://translate.codeberg.org/projects/searxng/searxng/zh_Hant/>\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 5.8.1\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
@ -180,7 +181,7 @@ msgstr "黑暗"
|
|||
#. STYLE_NAMES['BLACK']
|
||||
#: searx/searxng.msg
|
||||
msgid "black"
|
||||
msgstr ""
|
||||
msgstr "黑色"
|
||||
|
||||
#. BRAND_CUSTOM_LINKS['UPTIME']
|
||||
#: searx/searxng.msg
|
||||
|
@ -467,7 +468,7 @@ msgstr "計算 {functions} 參數"
|
|||
|
||||
#: searx/engines/mozhi.py:57
|
||||
msgid "Synonyms"
|
||||
msgstr ""
|
||||
msgstr "同義詞"
|
||||
|
||||
#: searx/engines/openstreetmap.py:159
|
||||
msgid "Get directions"
|
||||
|
@ -942,7 +943,7 @@ msgstr "來自搜尋引擎的訊息"
|
|||
|
||||
#: searx/templates/simple/elements/engines_msg.html:7
|
||||
msgid "seconds"
|
||||
msgstr ""
|
||||
msgstr "秒"
|
||||
|
||||
#: searx/templates/simple/elements/search_url.html:3
|
||||
msgid "Search URL"
|
||||
|
@ -1206,11 +1207,11 @@ msgstr "最大時間"
|
|||
|
||||
#: searx/templates/simple/preferences/favicon.html:2
|
||||
msgid "Favicon Resolver"
|
||||
msgstr ""
|
||||
msgstr "網站圖標搜索器"
|
||||
|
||||
#: searx/templates/simple/preferences/favicon.html:15
|
||||
msgid "Display favicons near search results"
|
||||
msgstr ""
|
||||
msgstr "在搜尋結果旁顯示網站圖標"
|
||||
|
||||
#: searx/templates/simple/preferences/footer.html:2
|
||||
msgid ""
|
||||
|
@ -1911,4 +1912,3 @@ msgstr "隱藏影片"
|
|||
|
||||
#~ msgid "Engines cannot retrieve results"
|
||||
#~ msgstr "引擎無法擷取結果"
|
||||
|
||||
|
|
|
@ -87,10 +87,7 @@ from searx.webadapter import (
|
|||
get_selected_categories,
|
||||
parse_lang,
|
||||
)
|
||||
from searx.utils import (
|
||||
gen_useragent,
|
||||
dict_subset,
|
||||
)
|
||||
from searx.utils import gen_useragent, dict_subset
|
||||
from searx.version import VERSION_STRING, GIT_URL, GIT_BRANCH
|
||||
from searx.query import RawTextQuery
|
||||
from searx.plugins import Plugin, plugins, initialize as plugin_initialize
|
||||
|
@ -104,13 +101,7 @@ from searx.answerers import (
|
|||
answerers,
|
||||
ask,
|
||||
)
|
||||
from searx.metrics import (
|
||||
get_engines_stats,
|
||||
get_engine_errors,
|
||||
get_reliabilities,
|
||||
histogram,
|
||||
counter,
|
||||
)
|
||||
from searx.metrics import get_engines_stats, get_engine_errors, get_reliabilities, histogram, counter, openmetrics
|
||||
from searx.flaskfix import patch_application
|
||||
|
||||
from searx.locales import (
|
||||
|
@ -1218,6 +1209,30 @@ def stats_checker():
|
|||
return jsonify(result)
|
||||
|
||||
|
||||
@app.route('/metrics')
|
||||
def stats_open_metrics():
|
||||
password = settings['general'].get("open_metrics")
|
||||
|
||||
if not (settings['general'].get("enable_metrics") and password):
|
||||
return Response('open metrics is disabled', status=404, mimetype='text/plain')
|
||||
|
||||
if not request.authorization or request.authorization.password != password:
|
||||
return Response('access forbidden', status=401, mimetype='text/plain')
|
||||
|
||||
filtered_engines = dict(filter(lambda kv: request.preferences.validate_token(kv[1]), engines.items()))
|
||||
|
||||
checker_results = checker_get_result()
|
||||
checker_results = (
|
||||
checker_results['engines'] if checker_results['status'] == 'ok' and 'engines' in checker_results else {}
|
||||
)
|
||||
|
||||
engine_stats = get_engines_stats(filtered_engines)
|
||||
engine_reliabilities = get_reliabilities(filtered_engines, checker_results)
|
||||
metrics_text = openmetrics(engine_stats, engine_reliabilities)
|
||||
|
||||
return Response(metrics_text, mimetype='text/plain')
|
||||
|
||||
|
||||
@app.route('/robots.txt', methods=['GET'])
|
||||
def robots():
|
||||
return Response(
|
||||
|
|
Loading…
Reference in New Issue