on master help sign in
[fix] oscar theme, remove inline style attributes (CSP compliants)

Inline styles are blocked by default with Content Security Policy (CSP). Move the rest of inline styles to CSS and correct the HTML template of the oscar preference page. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commitad208378bb78a35746db432011bcc08b4ffd708f authorMarkus Heiser <markus.heiser@darmarit.de> dateFri 15 May 2020, 10:16 (6 years ago) parent4954e56
2 files changed+30−12
searx/static/themes/oscar/less/logicodev/preferences.less+12 searx/templates/oscar/preferences.html+18−12
searx/static/themes/oscar/less/logicodev/preferences.less+12
@@ -1,3 +1,15 @@
11.table > tbody > tr > td, .table > tbody > tr > th {
22 vertical-align: middle !important;
33}
4+
5+.nav-tabs.nav-justified{
6+ margin-bottom: 20px;
7+}
8+
9+p {
10+ margin: 10px 0;
11+}
12+
13+input.cursor-text {
14+ margin: 10px 0;
15+}
searx/templates/oscar/preferences.html+18−12
@@ -9,7 +9,7 @@
99 <form method="post" action="{{ url_for('preferences') }}" id="search_form">
1010
1111 <!-- Nav tabs -->
12− <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
12+ <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist">
1313 <li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li>
1414 <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li>
1515 <li><a href="#tab_plugins" role="tab" data-toggle="tab">{{ _('Plugins') }}</a></li>
@@ -143,7 +143,7 @@
143143 <div class="tab-pane active_if_nojs" id="tab_engine">
144144
145145 <!-- Nav tabs -->
146− <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
146+ <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist">
147147 {% for categ in all_categories %}
148148 <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
149149 {% endfor %}
@@ -251,7 +251,7 @@
251251 <noscript>
252252 <h3>{{ _('Answerers') }}</h3>
253253 </noscript>
254− <p class="text-muted" style="margin:20px 0;">
254+ <p class="text-muted">
255255 {{ _('This is the list of searx\'s instant answering modules.') }}
256256 </p>
257257 <table class="table table-striped">
@@ -278,20 +278,20 @@
278278 <noscript>
279279 <h3>{{ _('Cookies') }}</h3>
280280 </noscript>
281− <p class="text-muted" style="margin:20px 0;">
281+ <p class="text-muted">
282282 {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
283283 {{ _('With that list, you can assess searx transparency.') }}<br />
284284 </p>
285285 {% if cookies %}
286286 <table class="table table-striped">
287287 <tr>
288− <th class="text-muted" style="padding-right:40px;">{{ _('Cookie name') }}</th>
288+ <th class="text-muted">{{ _('Cookie name') }}</th>
289289 <th class="text-muted">{{ _('Value') }}</th>
290290 </tr>
291291
292292 {% for cookie in cookies %}
293293 <tr>
294− <td class="text-muted" style="padding-right:40px;">{{ cookie }}</td>
294+ <td class="text-muted">{{ cookie }}</td>
295295 <td class="text-muted">{{ cookies[cookie] }}</td>
296296 </tr>
297297 {% endfor %}
@@ -301,17 +301,23 @@
301301 {% endif %}
302302 </div>
303303 </div>
304− <p class="text-muted" style="margin:20px 0;">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
305− <br />
306− {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
304+
305+ <p class="text-muted">
306+ {{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
307+ {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
307308 </p>
308− <p style="margin:20px 0;">{{ _('Search URL of the currently saved preferences') }} <small class="text-muted">({{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }})</small>:<br/>
309− <input readonly="" class="form-control select-all-on-click cursor-text" type="url" value="{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}">
309+
310+ <p>
311+ {{ _('Search URL of the currently saved preferences') }}
312+ <small class="text-muted">({{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }})</small>:
310313 </p>
311314
312− <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
315+ <div class="tab-pane">
316+ <input readonly="" class="form-control select-all-on-click cursor-text" type="url" value="{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}">
317+ <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
313318 <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
314319 <a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a>
320+ </div>
315321 </form>
316322</div>
317323{% endblock %}