[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:        <img src="{{ image_proxify(result.img_src or result.thumbnail) }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content">
    ./oscar/result_templates/files.html:24:<img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content">

Reported-by: https://github.com/searxng/searxng/issues/57
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-09-06 15:11:00 +02:00
parent e564cef0fe
commit 9d106ae972
6 changed files with 10 additions and 2 deletions

View File

@ -2,6 +2,7 @@
@import "../../../../__common__/less/new_issue.less"; @import "../../../../__common__/less/new_issue.less";
@import "../../../../__common__/less/stats.less"; @import "../../../../__common__/less/stats.less";
@import "../../../../__common__/less/result_templates.less"; @import "../../../../__common__/less/result_templates.less";
@import "../../less/result_templates.less";
@import "../../generated/pygments-logicodev.less"; @import "../../generated/pygments-logicodev.less";
@stacked-bar-chart: rgb(213, 216, 215, 1); @stacked-bar-chart: rgb(213, 216, 215, 1);

View File

@ -2,6 +2,7 @@
@import "../../../../__common__/less/new_issue.less"; @import "../../../../__common__/less/new_issue.less";
@import "../../../../__common__/less/stats.less"; @import "../../../../__common__/less/stats.less";
@import "../../../../__common__/less/result_templates.less"; @import "../../../../__common__/less/result_templates.less";
@import "../../less/result_templates.less";
@import "../../generated/pygments-logicodev.less"; @import "../../generated/pygments-logicodev.less";
@import "navbar.less"; @import "navbar.less";

View File

@ -2,6 +2,7 @@
@import "../../../../__common__/less/new_issue.less"; @import "../../../../__common__/less/new_issue.less";
@import "../../../../__common__/less/stats.less"; @import "../../../../__common__/less/stats.less";
@import "../../../../__common__/less/result_templates.less"; @import "../../../../__common__/less/result_templates.less";
@import "../../less/result_templates.less";
@import "../../generated/pygments-pointhi.less"; @import "../../generated/pygments-pointhi.less";
@import "footer.less"; @import "footer.less";

View File

@ -0,0 +1,5 @@
.default-image-style {
width: auto;
max-height: 60px;
min-height: 60px;
}

View File

@ -16,7 +16,7 @@
{%- if result.img_src or result.thumbnail -%} {%- if result.img_src or result.thumbnail -%}
<div class="container-fluid">{{- "" -}} <div class="container-fluid">{{- "" -}}
<div class="row">{{- "" -}} <div class="row">{{- "" -}}
<img src="{{ image_proxify(result.img_src or result.thumbnail) }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content"> <img src="{{ image_proxify(result.img_src or result.thumbnail) }}" title="{{ result.title|striptags }}" class="default-image-style" class="col-xs-2 col-sm-4 col-md-4 result-content">
{%- if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif -%} {%- if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif -%}
</div>{{- "" -}} </div>{{- "" -}}
</div> </div>

View File

@ -21,7 +21,7 @@
{%- if result.img_src -%} {%- if result.img_src -%}
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content"> <img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="default-image-style col-xs-2 col-sm-4 col-md-4 result-content">
{%- if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif -%} {%- if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif -%}
</div> </div>
</div> </div>