mirror of
https://github.com/searxng/searxng.git
synced 2025-07-24 13:49:26 +02:00
[enh] add settings option to enable/disable search formats
Access to formats can be denied by settings configuration:: search: formats: [html, csv, json, rss] Closes: https://github.com/searxng/searxng/issues/95 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
e1f244b2d5
commit
6ed4616da9
6 changed files with 81 additions and 3 deletions
|
@ -80,9 +80,10 @@
|
|||
<input id="search_url" type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ search_url() }}" readonly>{{- "" -}}
|
||||
</div>{{- "" -}}
|
||||
</form>
|
||||
{% if search_formats %}
|
||||
<label>{{ _('Download results') }}</label>
|
||||
<div class="clearfix"></div>
|
||||
{% for output_type in ('csv', 'json', 'rss') %}
|
||||
{% for output_type in search_formats %}
|
||||
<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download">
|
||||
{{- search_form_attrs(pageno) -}}
|
||||
<input type="hidden" name="format" value="{{ output_type }}">{{- "" -}}
|
||||
|
@ -90,8 +91,11 @@
|
|||
</form>
|
||||
{% endfor %}
|
||||
<div class="clearfix"></div>
|
||||
{% if 'rss' in search_formats %}
|
||||
<br /><label><a href="{{ search_url() }}&format=rss">{{ _('RSS subscription') }}</a></label>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /#sidebar_results -->
|
||||
|
|
|
@ -85,8 +85,9 @@
|
|||
<div class="selectable_url"><pre>{{ url_for('search', _external=True) }}?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 %}</pre></div>
|
||||
</div>
|
||||
<div id="apis">
|
||||
{% if search_formats %}
|
||||
<h4 class="title">{{ _('Download results') }}</h4>
|
||||
{% for output_type in ('csv', 'json', 'rss') %}
|
||||
{% for output_type in search_formats %}
|
||||
<div class="left">
|
||||
<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
|
||||
<input type="hidden" name="q" value="{{ q|e }}">
|
||||
|
@ -103,6 +104,7 @@
|
|||
</form>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue