1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-10 23:20:12 +01:00
searxng/searx/templates/simple/opensearch.xml
Markus Heiser a85907a98f [fix] opensearxh.xml: firefox v123 does not except self-URI (URL with param)
Before this patch we had a address in the rel-self-template with params [1]:

GET::

    <Url method="GET"
         rel="self"
         template="/opensearch.xml?method=GET&amp;autocomplete=google"
         type="application/opensearchdescription+xml"/>

POST::

    <Url method="POST"
         rel="self"
         template="/opensearch.xml?method=POST&amp;autocomplete=google"
         type="application/opensearchdescription+xml"/>

The first one (GET) is no longer accepted by firefox since v123, the latter one
was always been wrong (since it mixes GET params with a POST request).

Since Firefox v123 a template syntax [2] in the rel-self-template is no longer
supported / Firefox will report an error::

    Firefox could not download the search plugin from:
    http://127.0.0.1:8888//opensearch.xml?method=GET&autocomplete=google

This patch reduce the URL to::

    template="http://127.0.0.1:8888/opensearch.xml"

[1] https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#url-rel-values
[2] https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#opensearch-url-template-syntax

Closes: https://github.com/searxng/searxng/issues/3227
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-02-25 07:33:04 +01:00

22 lines
1.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>{{ instance_name }}</ShortName>
<LongName>SearXNG metasearch</LongName>
<Description>SearXNG is a metasearch engine that respects your privacy.</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image type="image/png">{{ url_for('static', filename='img/favicon.png', _external=True) }}</Image>
{% if opensearch_method == 'GET' %}
<Url rel="results" type="text/html" method="{{ opensearch_method }}" template="{{ url_for('search', _external=True) }}?q={searchTerms}"/>
{% else %}
<Url rel="results" type="text/html" method="{{ opensearch_method }}" template="{{ url_for('search', _external=True) }}">
<Param name="q" value="{searchTerms}" />
</Url>
{% endif %}
{% if autocomplete %}
<Url rel="suggestions" type="application/x-suggestions+json" method="{{ opensearch_method }}" template="{{ url_for('autocompleter', _external=True) }}?q={searchTerms}"/>
{% endif %}
<Url rel="self" type="application/opensearchdescription+xml" method="{{ opensearch_method }}" template="{{ url_for('opensearch', _external=True) }}" />
<Query role="example" searchTerms="SearXNG" />
<moz:SearchForm>{{ url_for('search', _external=True) }}</moz:SearchForm>
</OpenSearchDescription>