From 9d106ae972f0d5ae72d2e7cd5fae28c4d56deb14 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 6 Sep 2021 15:11:00 +0200 Subject: [PATCH] [fix] make oscar theme more CSP compliant - default-image-style Add default-image-style in:: searx/static/themes/oscar/src/less/result_templates.less Replaced style= in files:: ./oscar/result_templates/default.html:19: ./oscar/result_templates/files.html:24:{{ result.title|striptags }} Reported-by: https://github.com/searxng/searxng/issues/57 Signed-off-by: Markus Heiser --- searx/static/themes/oscar/src/less/logicodev-dark/oscar.less | 1 + searx/static/themes/oscar/src/less/logicodev/oscar.less | 1 + searx/static/themes/oscar/src/less/pointhi/oscar.less | 1 + searx/static/themes/oscar/src/less/result_templates.less | 5 +++++ searx/templates/oscar/result_templates/default.html | 2 +- searx/templates/oscar/result_templates/files.html | 2 +- 6 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 searx/static/themes/oscar/src/less/result_templates.less diff --git a/searx/static/themes/oscar/src/less/logicodev-dark/oscar.less b/searx/static/themes/oscar/src/less/logicodev-dark/oscar.less index c1a2fc236..199d76e08 100644 --- a/searx/static/themes/oscar/src/less/logicodev-dark/oscar.less +++ b/searx/static/themes/oscar/src/less/logicodev-dark/oscar.less @@ -2,6 +2,7 @@ @import "../../../../__common__/less/new_issue.less"; @import "../../../../__common__/less/stats.less"; @import "../../../../__common__/less/result_templates.less"; +@import "../../less/result_templates.less"; @import "../../generated/pygments-logicodev.less"; @stacked-bar-chart: rgb(213, 216, 215, 1); diff --git a/searx/static/themes/oscar/src/less/logicodev/oscar.less b/searx/static/themes/oscar/src/less/logicodev/oscar.less index 19e1c98f1..e9dc1f532 100644 --- a/searx/static/themes/oscar/src/less/logicodev/oscar.less +++ b/searx/static/themes/oscar/src/less/logicodev/oscar.less @@ -2,6 +2,7 @@ @import "../../../../__common__/less/new_issue.less"; @import "../../../../__common__/less/stats.less"; @import "../../../../__common__/less/result_templates.less"; +@import "../../less/result_templates.less"; @import "../../generated/pygments-logicodev.less"; @import "navbar.less"; diff --git a/searx/static/themes/oscar/src/less/pointhi/oscar.less b/searx/static/themes/oscar/src/less/pointhi/oscar.less index 5961c661e..e7ea08b18 100644 --- a/searx/static/themes/oscar/src/less/pointhi/oscar.less +++ b/searx/static/themes/oscar/src/less/pointhi/oscar.less @@ -2,6 +2,7 @@ @import "../../../../__common__/less/new_issue.less"; @import "../../../../__common__/less/stats.less"; @import "../../../../__common__/less/result_templates.less"; +@import "../../less/result_templates.less"; @import "../../generated/pygments-pointhi.less"; @import "footer.less"; diff --git a/searx/static/themes/oscar/src/less/result_templates.less b/searx/static/themes/oscar/src/less/result_templates.less new file mode 100644 index 000000000..80b3822c4 --- /dev/null +++ b/searx/static/themes/oscar/src/less/result_templates.less @@ -0,0 +1,5 @@ +.default-image-style { + width: auto; + max-height: 60px; + min-height: 60px; +} diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html index 53cfee5cb..2f0158b46 100644 --- a/searx/templates/oscar/result_templates/default.html +++ b/searx/templates/oscar/result_templates/default.html @@ -16,7 +16,7 @@ {%- if result.img_src or result.thumbnail -%}
{{- "" -}}
{{- "" -}} - + {%- if result.content %}

{{ result.content|safe }}

{% endif -%}
{{- "" -}}
diff --git a/searx/templates/oscar/result_templates/files.html b/searx/templates/oscar/result_templates/files.html index e2fec6f63..52798f7d8 100644 --- a/searx/templates/oscar/result_templates/files.html +++ b/searx/templates/oscar/result_templates/files.html @@ -21,7 +21,7 @@ {%- if result.img_src -%}
-{{ result.title|striptags }} +{{ result.title|striptags }} {%- if result.content %}

{{ result.content|safe }}

{% endif -%}