Browse Source

Merge branch 'master' of https://github.com/asciimoo/searx into filtron

Markus Heiser 4 years ago
parent
commit
6fc26775e4

+ 4 - 0
docs/admin/engines.rst

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

+ 4 - 1
docs/admin/settings.rst

@@ -104,7 +104,7 @@ Global Settings
   specific instance of searx, a locale can be defined using an ISO language
   specific instance of searx, a locale can be defined using an ISO language
   code, like ``fr``, ``en``, ``de``.
   code, like ``fr``, ``en``, ``de``.
 
 
-.. _requests proxies: http://docs.python-requests.org/en/latest/user/advanced/#proxies
+.. _requests proxies: http://requests.readthedocs.io/en/latest/user/advanced/#proxies
 .. _PR SOCKS support: https://github.com/kennethreitz/requests/pull/478
 .. _PR SOCKS support: https://github.com/kennethreitz/requests/pull/478
 
 
 ``outgoing_proxies`` :
 ``outgoing_proxies`` :
@@ -181,6 +181,9 @@ Engine settings
 ``weigth`` : default ``1``
 ``weigth`` : default ``1``
   Weighting of the results of this engine.
   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::
 .. note::
 
 
    A few more options are possible, but they are pretty specific to some
    A few more options are possible, but they are pretty specific to some

+ 1 - 0
docs/dev/engine_overview.rst

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

+ 1 - 0
searx/engines/__init__.py

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

+ 2 - 1
searx/results.py

@@ -346,7 +346,8 @@ class ResultContainer(object):
         return resultnum_sum / len(self._number_of_results)
         return resultnum_sum / len(self._number_of_results)
 
 
     def add_unresponsive_engine(self, engine_name, error_type, error_message=None):
     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):
     def add_timing(self, engine_name, engine_time, page_load_time):
         self.timings.append({
         self.timings.append({

+ 1 - 1
searx/settings.yml

@@ -41,7 +41,7 @@ outgoing: # communication with search engines
     pool_maxsize : 10 # Number of simultaneous requests by host
     pool_maxsize : 10 # Number of simultaneous requests by host
 # uncomment below section if you want to use a proxy
 # uncomment below section if you want to use a proxy
 # see http://docs.python-requests.org/en/latest/user/advanced/#proxies
 # see http://docs.python-requests.org/en/latest/user/advanced/#proxies
-# SOCKS proxies are also supported: see http://docs.python-requests.org/en/master/user/advanced/#socks
+# SOCKS proxies are also supported: see http://requests.readthedocs.io/en/master/user/advanced/#socks
 #    proxies :
 #    proxies :
 #        http : http://127.0.0.1:8080
 #        http : http://127.0.0.1:8080
 #        https: http://127.0.0.1:8080
 #        https: http://127.0.0.1:8080

+ 10 - 0
searx/static/themes/oscar/js/searx.js

@@ -357,3 +357,13 @@ $(document).ready(function(){
         $( this ).off( event );
         $( 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 it is too large
+ 0 - 1
searx/static/themes/oscar/js/searx.min.js


+ 10 - 0
searx/static/themes/oscar/js/searx_src/toggleall.js

@@ -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;});
+    });
+});
+

+ 1 - 1
searx/templates/courgette/search.html

@@ -1,6 +1,6 @@
 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form">
 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form">
     <div id="search_wrapper">
     <div id="search_wrapper">
-        <input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/>
+        <input type="text" autofocus placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/>
         <input type="submit" value="search" id="search_submit" />
         <input type="submit" value="search" id="search_submit" />
     </div>
     </div>
     {% include 'courgette/categories.html' %}
     {% include 'courgette/categories.html' %}

+ 1 - 1
searx/templates/legacy/search.html

@@ -1,6 +1,6 @@
 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form">
 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form">
     <div id="search_wrapper">
     <div id="search_wrapper">
-        <input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" size="100" {% if q %}value="{{ q }}"{% endif %}/>
+        <input type="text" autofocus placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" size="100" {% if q %}value="{{ q }}"{% endif %}/>
         <input type="submit" value="search" id="search_submit" />
         <input type="submit" value="search" id="search_submit" />
     </div>
     </div>
     {% set display_tooltip = true %}
     {% set display_tooltip = true %}

+ 22 - 14
searx/templates/oscar/preferences.html

@@ -155,6 +155,14 @@
 
 
                 <!-- Tab panes -->
                 <!-- Tab panes -->
                 <div class="tab-content">
                 <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 %}
                     {% for categ in all_categories %}
                     <noscript><label>{{ _(categ) }}</label>
                     <noscript><label>{{ _(categ) }}</label>
                     </noscript>
                     </noscript>
@@ -174,14 +182,14 @@
                                     <th>{{ _("Avg. time") }}</th>
                                     <th>{{ _("Avg. time") }}</th>
                                     <th>{{ _("Max time") }}</th>
                                     <th>{{ _("Max time") }}</th>
                                     {% else %}
                                     {% 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 %}
                                     {% endif %}
                                 </tr>
                                 </tr>
                         {% for search_engine in engines_by_category[categ] %}
                         {% for search_engine in engines_by_category[categ] %}
@@ -256,10 +264,10 @@
                 </p>
                 </p>
                 <table class="table table-striped">
                 <table class="table table-striped">
                     <tr>
                     <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>
                     </tr>
 
 
                     {% for answerer in answerers %}
                     {% for answerer in answerers %}
@@ -285,8 +293,8 @@
                 {% if cookies %}
                 {% if cookies %}
                 <table class="table table-striped">
                 <table class="table table-striped">
                     <tr>
                     <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>
                     </tr>
 
 
                     {% for cookie in cookies %}
                     {% for cookie in cookies %}

+ 1 - 1
searx/templates/oscar/search.html

@@ -3,7 +3,7 @@
   <div class="row">
   <div class="row">
     <div class="col-xs-12 col-md-8">
     <div class="col-xs-12 col-md-8">
       <div class="input-group search-margin">
       <div class="input-group search-margin">
-        <input type="search" name="q" class="form-control" id="q" placeholder="{{ _('Search for...') }}" aria-label="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}" accesskey="s">
+        <input type="search" autofocus name="q" class="form-control" id="q" placeholder="{{ _('Search for...') }}" aria-label="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}" accesskey="s">
         <span class="input-group-btn">
         <span class="input-group-btn">
             <button type="submit" class="btn btn-default" aria-label="{{ _('Start search') }}"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
             <button type="submit" class="btn btn-default" aria-label="{{ _('Start search') }}"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
             <button type="reset" class="btn btn-default" aria-label="{{ _('Clear search') }}"><span class="hide_if_nojs">{{ icon('remove') }}</span><span class="hidden active_if_nojs">{{ _('Clear') }}</span></button>
             <button type="reset" class="btn btn-default" aria-label="{{ _('Clear search') }}"><span class="hide_if_nojs">{{ icon('remove') }}</span><span class="hidden active_if_nojs">{{ _('Clear') }}</span></button>

+ 1 - 1
searx/templates/oscar/search_full.html

@@ -6,7 +6,7 @@
     {% else %}
     {% else %}
     <div class="input-group col-md-8 col-md-offset-2">
     <div class="input-group col-md-8 col-md-offset-2">
     {% endif %}
     {% endif %}
-        <input type="search" name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" aria-label="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}" accesskey="s">
+        <input type="search" autofocus name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" aria-label="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}" accesskey="s">
         <span class="input-group-btn">
         <span class="input-group-btn">
             <button type="submit" class="btn btn-default input-lg" aria-label="{{ _('Start search') }}"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
             <button type="submit" class="btn btn-default input-lg" aria-label="{{ _('Start search') }}"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
             <button type="reset" class="btn btn-default input-lg" aria-label="{{ _('Clear search') }}"><span class="hide_if_nojs">{{ icon('remove') }}</span><span class="hidden active_if_nojs">{{ _('Clear') }}</span></button>
             <button type="reset" class="btn btn-default input-lg" aria-label="{{ _('Clear search') }}"><span class="hide_if_nojs">{{ icon('remove') }}</span><span class="hidden active_if_nojs">{{ _('Clear') }}</span></button>

+ 1 - 1
searx/templates/pix-art/search.html

@@ -1,6 +1,6 @@
 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form">
 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form">
     <div id="search_wrapper">
     <div id="search_wrapper">
-        <input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" size="100" {% if q %}value="{{ q }}"{% endif %}/>
+        <input type="text" autofocus placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" size="100" {% if q %}value="{{ q }}"{% endif %}/>
         <input type="submit" value="" id="search_submit" />
         <input type="submit" value="" id="search_submit" />
         {% for category in categories %}
         {% for category in categories %}
         <input type="hidden" name="category_{{ category }}" value="1"/>
         <input type="hidden" name="category_{{ category }}" value="1"/>

+ 1 - 1
searx/templates/simple/search.html

@@ -1,7 +1,7 @@
 <form id="search" method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
 <form id="search" method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
   <div id="search_wrapper">
   <div id="search_wrapper">
     <div class="search_box">
     <div class="search_box">
-      <input id="q" name="q" type="text" placeholder="{{ _('Search for...') }}" tabindex="1" autocomplete="off" spellcheck="false" dir="auto" {% if q %}value="{{ q }}"{% endif %} >
+      <input id="q" autofocus name="q" type="text" placeholder="{{ _('Search for...') }}" tabindex="1" autocomplete="off" spellcheck="false" dir="auto" {% if q %}value="{{ q }}"{% endif %} >
       <button id="clear_search" type="button" tabindex="-1"><span class="hide_if_nojs">{{ icon('close') }}</span><span class="show_if_nojs">{{ _('Clear search') }}</span></button>
       <button id="clear_search" type="button" tabindex="-1"><span class="hide_if_nojs">{{ icon('close') }}</span><span class="show_if_nojs">{{ _('Clear search') }}</span></button>
       <button id="send_search" type="submit" tabindex="-1"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="show_if_nojs">{{ _('Start search') }}</span></button>
       <button id="send_search" type="submit" tabindex="-1"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="show_if_nojs">{{ _('Start search') }}</span></button>
     </div>
     </div>

BIN
searx/translations/fa_IR/LC_MESSAGES/messages.mo


+ 1 - 1
searx/translations/fa_IR/LC_MESSAGES/messages.po

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

+ 1 - 1
searx/webapp.py

@@ -144,7 +144,7 @@ if not searx_debug \
 
 
 babel = Babel(app)
 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']
                'ku', 'mzn', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']
 
 
 # used when translating category names
 # used when translating category names

Some files were not shown because too many files changed in this diff