From 72029d27ded8d93ab891c616d6bffbe8d3a67dd2 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Fri, 2 Aug 2019 13:50:51 +0200 Subject: [enh] Add timeout limit per request (#1640) The new url parameter "timeout_limit" set timeout limit defined in second. Example "timeout_limit=1.5" means the timeout limit is 1.5 seconds. In addition, the query can start with <[number] to set the timeout limit. For number between 0 and 99, the unit is the second : Example: "<30 searx" means the timeout limit is 3 seconds For number above 100, the unit is the millisecond: Example: "<850 searx" means the timeout is 850 milliseconds. In addition, there is a new optional setting: outgoing.max_request_timeout. If not set, the user timeout can't go above searx configuration (as before: the max timeout of selected engine for a query). If the value is set, the user can set a timeout between 0 and max_request_timeout using <[number] or timeout_limit query parameter. Related to #1077 Updated version of PR #1413 from @isj-privacore --- searx/templates/oscar/results.html | 1 + searx/templates/simple/infobox.html | 5 +++++ searx/templates/simple/results.html | 12 +++++++++--- searx/templates/simple/search.html | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) (limited to 'searx/templates') diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html index f712e5779..ce557daf9 100644 --- a/searx/templates/oscar/results.html +++ b/searx/templates/oscar/results.html @@ -5,6 +5,7 @@ + {%- endmacro %} {%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if time_range %}&time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&language={{ current_language }}{% endif %}{% endmacro -%} diff --git a/searx/templates/simple/infobox.html b/searx/templates/simple/infobox.html index d99806ac4..50b568919 100644 --- a/searx/templates/simple/infobox.html +++ b/searx/templates/simple/infobox.html @@ -36,6 +36,11 @@ {% for suggestion in topic.suggestions %}
+ + + + + {% if timeout_limit %}{% endif %}
{% endfor %} diff --git a/searx/templates/simple/results.html b/searx/templates/simple/results.html index a8e899e57..770eebe81 100644 --- a/searx/templates/simple/results.html +++ b/searx/templates/simple/results.html @@ -51,9 +51,11 @@ {% for suggestion in suggestions %}
+ + {% if timeout_limit %}{% endif %}
{% endfor %} @@ -63,7 +65,7 @@

{{ _('Search URL') }} :

-
{{ base_url }}?q={{ q|urlencode }}&language={{ current_language }}&time_range={{ time_range }}&safesearch={{ safesearch }}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}
+
{{ base_url }}?q={{ q|urlencode }}&language={{ current_language }}&time_range={{ time_range }}&safesearch={{ safesearch }}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if timeout_limit %}&timeout_limit={{ timeout_limit|urlencode }}{% endif %}

{{ _('Download results') }}

@@ -79,6 +81,7 @@ + {% if timeout_limit %}{% endif %}
@@ -97,6 +100,7 @@ + {% if timeout_limit %}{% endif %} @@ -134,7 +138,8 @@ - + {% if timeout_limit %}{% endif %} + {% endif %} @@ -149,7 +154,8 @@ - + {% if timeout_limit %}{% endif %} + diff --git a/searx/templates/simple/search.html b/searx/templates/simple/search.html index 9c4a99b68..e9023b420 100644 --- a/searx/templates/simple/search.html +++ b/searx/templates/simple/search.html @@ -14,4 +14,5 @@ {% include 'simple/categories.html' %} + {% if timeout_limit %}{% endif %} -- cgit v1.2.3 From ba80a0ba380d0177634a471f38142f840e06b9b5 Mon Sep 17 00:00:00 2001 From: Dalf Date: Fri, 2 Aug 2019 20:04:37 +0200 Subject: [fix] fix paging for the oscar theme after PR #1640 --- searx/templates/oscar/results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/templates') diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html index ce557daf9..9a95265b9 100644 --- a/searx/templates/oscar/results.html +++ b/searx/templates/oscar/results.html @@ -5,7 +5,7 @@ - + {% if timeout_limit %}{% endif %} {%- endmacro %} {%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if time_range %}&time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&language={{ current_language }}{% endif %}{% endmacro -%} -- cgit v1.2.3 From e4e8e6da4c90d3d65418aeaf1d7ebfc64c497685 Mon Sep 17 00:00:00 2001 From: Frank de Lange Date: Tue, 6 Aug 2019 09:31:24 +0200 Subject: Add image format and source information to display (#1567) Add image format and source information to display - needs changes to engines to actually display something. Displays result.source (website from which the image was taken) and result.img_format (image type and size). Result is styled with result-format and result-source classes. See PR #1566 for an example of an engine which has the necessary changes. Strip ... in the oscar image template. --- searx/templates/oscar/result_templates/images.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'searx/templates') diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html index b23f34915..b3292f448 100644 --- a/searx/templates/oscar/result_templates/images.html +++ b/searx/templates/oscar/result_templates/images.html @@ -16,7 +16,17 @@ {% if result.author %}{{ result.author }}
{% endif %} {% if result.content %}

- {{ result.content }} + {{ result.content|striptags }} +

+ {% endif %} + {% if result.img_format %} +

+ {{ result.img_format }} +

+ {% endif %} + {% if result.source %} +

+ {{ result.source }}

{% endif %} -- cgit v1.2.3 From 6fbba63c83b18a652e571ce5a803773cd72e5b6a Mon Sep 17 00:00:00 2001 From: Dalf Date: Tue, 23 Jul 2019 14:13:38 +0200 Subject: oscar and simple themes: no inline script (allow A+ Content-Security-Policy) --- searx/templates/oscar/base.html | 10 +++------- searx/templates/simple/base.html | 25 +++++++++++-------------- 2 files changed, 14 insertions(+), 21 deletions(-) (limited to 'searx/templates') diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html index 243e8b3d7..321784ebb 100644 --- a/searx/templates/oscar/base.html +++ b/searx/templates/oscar/base.html @@ -37,12 +37,6 @@ {% endblock %} - -