1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-04 20:30:11 +01:00

Merge pull request #2247 from dalf/fix-opensearch

[fix] opensearch.xml URL contains method and autocomplete parameters
This commit is contained in:
Alexandre Flament 2020-10-07 10:14:57 +02:00 committed by GitHub
commit e30dc2f0ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 5 deletions

View File

@ -15,4 +15,8 @@
{% if autocomplete %}
<Url rel="suggestions" type="application/x-suggestions+json" template="{{ host }}autocompleter?q={searchTerms}"/>
{% endif %}
<Url type="application/opensearchdescription+xml"
rel="self"
template="{{ opensearch_url }}" />
</OpenSearchDescription>

View File

@ -9,7 +9,7 @@
<opensearch:totalResults>{{ number_of_results }}</opensearch:totalResults>
<opensearch:startIndex>1</opensearch:startIndex>
<opensearch:itemsPerPage>{{ number_of_results }}</opensearch:itemsPerPage>
<atom:link rel="search" type="application/opensearchdescription+xml" href="{{ base_url }}opensearch.xml"/>
<atom:link rel="search" type="application/opensearchdescription+xml" href="{{ opensearch_url }}"/>
<opensearch:Query role="request" searchTerms="{{ q|e }}" startPage="1" />
{% if error_message %}
<item>

View File

@ -22,7 +22,7 @@
{% endblock %}
{% block meta %}{% endblock %}
{% block head %}
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ opensearch_url }}"/>
{% endblock %}
<script type="text/javascript">
searx = {};

View File

@ -17,7 +17,7 @@
{% endblock %}
{% block meta %}{% endblock %}
{% block head %}
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ opensearch_url }}"/>
{% endblock %}
</head>
<body class="{{ endpoint }}_endpoint" >

View File

@ -37,7 +37,7 @@
{% block head %}
{% endblock %}
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ opensearch_url }}"/>
<noscript>
<style type="text/css">
.tab-content > .active_if_nojs, .active_if_nojs {display: block !important; visibility: visible !important;}

View File

@ -29,7 +29,7 @@
data-no-item-found="{{ _('No item found') }}"></script>
<!--<![endif]-->
{% block head %}
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ opensearch_url }}"/>
{% endblock %}
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" />
</head>

View File

@ -386,6 +386,9 @@ def render(template_name, override_theme=None, **kwargs):
kwargs['proxify'] = proxify if settings.get('result_proxy', {}).get('url') else None
kwargs['opensearch_url'] = url_for('opensearch') + '?' \
+ urlencode({'method': kwargs['method'], 'autocomplete': kwargs['autocomplete']})
kwargs['get_result_template'] = get_result_template
kwargs['theme'] = get_current_theme_name(override=override_theme)