Merge branch 'master' into gigablast

This commit is contained in:
Markus Heiser 2020-06-01 06:23:45 +00:00 committed by GitHub
commit 74135007eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 57 additions and 19 deletions

View file

@ -26,6 +26,8 @@ Safe search **SS**
Weigth **W**
------------- ----------- ---------------------------------
Disabled **D**
------------- ----------- ---------------------------------
Show errors **DE**
============= =========== =================================
Configuration defaults (at built time):
@ -51,6 +53,7 @@ Configuration defaults (at built time):
- O
- W
- D
- DE
{% for name, mod in engines.items() %}
@ -67,5 +70,6 @@ Configuration defaults (at built time):
- {{(mod.offline and "y") or ""}}
- {{mod.weight or 1 }}
- {{(mod.disabled and "y") or ""}}
- {{(mod.display_error_messages and "y") or ""}}
{% endfor %}

View file

@ -175,6 +175,9 @@ Engine settings
``weigth`` : default ``1``
Weighting of the results of this engine.
``display_error_messages`` : default ``True``
When an engine returns an error, the message is displayed on the user interface.
.. note::
A few more options are possible, but they are pretty specific to some

View file

@ -57,6 +57,7 @@ engine string name of searx-engine
(filename without ``.py``)
shortcut string shortcut of search-engine
timeout string specific timeout for search-engine
display_error_messages boolean display error messages on the web UI
======================= =========== ===========================================

View file

@ -55,6 +55,7 @@ engine_default_args = {'paging': False,
'continuous_errors': 0,
'time_range_support': False,
'offline': False,
'display_error_messages': True,
'tokens': []}

View file

@ -346,7 +346,8 @@ class ResultContainer(object):
return resultnum_sum / len(self._number_of_results)
def add_unresponsive_engine(self, engine_name, error_type, error_message=None):
self.unresponsive_engines.add((engine_name, error_type, error_message))
if engines[engine_name].display_error_messages:
self.unresponsive_engines.add((engine_name, error_type, error_message))
def add_timing(self, engine_name, engine_time, page_load_time):
self.timings.append({

View file

@ -357,3 +357,13 @@ $(document).ready(function(){
$( this ).off( event );
});
});
;$(document).ready(function(){
$("#allow-all-engines").click(function() {
$(".onoffswitch-checkbox").each(function() { this.checked = false;});
});
$("#disable-all-engines").click(function() {
$(".onoffswitch-checkbox").each(function() { this.checked = true;});
});
});

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
$(document).ready(function(){
$("#allow-all-engines").click(function() {
$(".onoffswitch-checkbox").each(function() { this.checked = false;});
});
$("#disable-all-engines").click(function() {
$(".onoffswitch-checkbox").each(function() { this.checked = true;});
});
});

View file

@ -155,6 +155,14 @@
<!-- Tab panes -->
<div class="tab-content">
<div class="hide_if_nojs">
<p class="text-{% if rtl %}left{% else %}right{% endif %}">
<button type="button" class="btn btn-default btn-success" id="allow-all-engines">{{ _("Allow all") }}</button>
<button type="button" class="btn btn-default btn-danger" id="disable-all-engines">{{ _("Disable all") }}</button>
</p>
</div>
{% for categ in all_categories %}
<noscript><label>{{ _(categ) }}</label>
</noscript>
@ -174,14 +182,14 @@
<th>{{ _("Avg. time") }}</th>
<th>{{ _("Max time") }}</th>
{% else %}
<th>{{ _("Max time") }}</th>
<th>{{ _("Avg. time") }}</th>
<th>{{ _("Time range") }}</th>
<th>{{ _("SafeSearch") }}</th>
<th>{{ _("Selected language") }}</th>
<th>{{ _("Shortcut") }}</th>
<th>{{ _("Engine name") }}</th>
<th>{{ _("Allow") }}</th>
<th class="text-right">{{ _("Max time") }}</th>
<th class="text-right">{{ _("Avg. time") }}</th>
<th class="text-right">{{ _("Time range") }}</th>
<th class="text-right">{{ _("SafeSearch") }}</th>
<th class="text-right">{{ _("Selected language") }}</th>
<th class="text-right">{{ _("Shortcut") }}</th>
<th class="text-right">{{ _("Engine name") }}</th>
<th class="text-right">{{ _("Allow") }}</th>
{% endif %}
</tr>
{% for search_engine in engines_by_category[categ] %}
@ -256,10 +264,10 @@
</p>
<table class="table table-striped">
<tr>
<th class="text-muted">{{ _('Name') }}</th>
<th class="text-muted">{{ _('Keywords') }}</th>
<th class="text-muted">{{ _('Description') }}</th>
<th class="text-muted">{{ _('Examples') }}</th>
<th class="text-muted{% if rtl %} text-right{% endif %}">{{ _('Name') }}</th>
<th class="text-muted{% if rtl %} text-right{% endif %}">{{ _('Keywords') }}</th>
<th class="text-muted{% if rtl %} text-right{% endif %}">{{ _('Description') }}</th>
<th class="text-muted{% if rtl %} text-right{% endif %}">{{ _('Examples') }}</th>
</tr>
{% for answerer in answerers %}
@ -285,8 +293,8 @@
{% if cookies %}
<table class="table table-striped">
<tr>
<th class="text-muted" style="padding-right:40px;">{{ _('Cookie name') }}</th>
<th class="text-muted">{{ _('Value') }}</th>
<th class="text-muted{% if rtl %} text-right{% endif %}" style="padding-right:40px;">{{ _('Cookie name') }}</th>
<th class="text-muted{% if rtl %} text-right{% endif %}">{{ _('Value') }}</th>
</tr>
{% for cookie in cookies %}

View file

@ -109,7 +109,7 @@ msgstr "توابع آماری"
#: searx/answerers/statistics/answerer.py:54
msgid "Compute {functions} of the arguments"
msgstr "پردازش {عملکرد های} نشانوند ها<br>"
msgstr "پردازش {functions} نشانوند ها<br>"
#: searx/engines/__init__.py:194
msgid "Engine time (sec)"

View file

@ -144,7 +144,7 @@ if not searx_debug \
babel = Babel(app)
rtl_locales = ['ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he',
rtl_locales = ['ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'fa_IR', 'glk', 'he',
'ku', 'mzn', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']
# used when translating category names