From 34859d0e5872499c72fcaebb67ca57f95beb9864 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 16 May 2021 17:57:04 +0200 Subject: [PATCH] [fix] make /stats more CSP compliant - oscar theme Replace oscar theme's *styles* (see below) by CSP compliant implementation in ``searx/static/themes/__common__/less/stats.less`` :: ./oscar/stats.html:29: {{ th_sort('name', _("Engine name")) }} ./oscar/stats.html:30: {{ th_sort('score', _('Scores')) }} ./oscar/stats.html:33: {{ th_sort('reliability', _('Reliability')) }} ./oscar/stats.html:38: ./oscar/stats.html:91: {{ engine_reliabilities.get(engine_stat.name, {}).get('reliablity') }} ./oscar/stats.html:109: ./oscar/stats.html:112: {{ _('Exception') }}{{ error.exception_classname }} ./oscar/stats.html:114: {{ _('Message') }}{{ error.log_message }} ./oscar/stats.html:116: {{ _('Percentage') }}{{ error.percentage }} ./oscar/stats.html:121: {{ param }} ./oscar/stats.html:138: {{ _('Failed test') }} Reported-by: https://github.com/searxng/searxng/issues/57 Signed-off-by: Markus Heiser --- searx/templates/oscar/stats.html | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/searx/templates/oscar/stats.html b/searx/templates/oscar/stats.html index 8b57e39b6..d75a29d1f 100644 --- a/searx/templates/oscar/stats.html +++ b/searx/templates/oscar/stats.html @@ -24,18 +24,18 @@ {% include 'oscar/messages/no_data_available.html' %} {% else %} - +
- - - - - + + + + + {% for engine_stat in engine_stats.get('time', []) %} - - + - - - + {% endfor %}
{{ th_sort('name', _("Engine name")) }}{{ th_sort('score', _('Scores')) }}{{ th_sort('result_count', _('Result count')) }}{{ th_sort('time', _('Response time')) }}{{ th_sort('reliability', _('Reliability')) }}{{ th_sort('name', _("Engine name")) }}{{ th_sort('score', _('Scores')) }}{{ th_sort('result_count', _('Result count')) }}{{ th_sort('time', _('Response time')) }}{{ th_sort('reliability', _('Reliability')) }}
{{ engine_stat.name }} + {{ engine_stat.name }} {%- if engine_stat.score -%} {{ engine_stat.score|round(1) }} {%- endif -%} + {%- if engine_stat.result_count -%}
{{- engine_stat.result_count | int -}}
{{- "" -}} {%- endif -%}
+ {%- if engine_stat.total -%}
{{- engine_stat.total | round(1) -}}
{{- "" -}} {%- endif -%}
{{ engine_reliabilities.get(engine_stat.name, {}).get('reliablity') }} {{ engine_reliabilities.get(engine_stat.name, {}).get('reliablity') }}
@@ -105,20 +105,20 @@ {% set ns.first = false %}

{% if secondary %}{{ _('Warnings') }}{% else %}{{ _('Errors and exceptions') }}{% endif %}

{% endif %} - - +
+ {%- if error.exception_classname -%} - + {%- elif error.log_message -%} - + {%- endif -%} - + {% if error.log_parameters and error.log_parameters != (None, None, None) %}{{- '' -}} @@ -135,7 +135,7 @@

{{ _('Checker') }}

{{ _('Exception') }}{{ error.exception_classname }}{{ _('Exception') }}{{ error.exception_classname }}{{ _('Message') }}{{ error.log_message }}{{ _('Message') }}{{ error.log_message }}{{ _('Percentage') }}{{ error.percentage }}{{ _('Percentage') }}{{ error.percentage }}
{{ _('Parameter') }} {%- for param in error.log_parameters -%} - {{ param }} + {{ param }} {%- endfor -%}
- + {% for test_name, results in engine_reliabilities[selected_engine_name].checker.items() %}
{{ _('Failed test') }}{{ _('Failed test') }} {{ _('Comment(s)') }}