Pārlūkot izejas kodu

[fix] opensearch image issue - closes #507

Adam Tauber 9 gadus atpakaļ
vecāks
revīzija
bc81eda64b

+ 1
- 1
searx/templates/courgette/opensearch.xml Parādīt failu

3
   <ShortName>{{ instance_name }}</ShortName>
3
   <ShortName>{{ instance_name }}</ShortName>
4
   <Description>a privacy-respecting, hackable metasearch engine</Description>
4
   <Description>a privacy-respecting, hackable metasearch engine</Description>
5
   <InputEncoding>UTF-8</InputEncoding>
5
   <InputEncoding>UTF-8</InputEncoding>
6
-  <Image>{{ host }}{{ url_for('static', filename='img/favicon.png') | replace("/", "", 1) }}</Image>
6
+  <Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image>
7
   <LongName>searx metasearch</LongName>
7
   <LongName>searx metasearch</LongName>
8
   {% if opensearch_method == 'get' %}
8
   {% if opensearch_method == 'get' %}
9
     <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>
9
     <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>

+ 1
- 1
searx/templates/default/opensearch.xml Parādīt failu

3
   <ShortName>{{ instance_name }}</ShortName>
3
   <ShortName>{{ instance_name }}</ShortName>
4
   <Description>a privacy-respecting, hackable metasearch engine</Description>
4
   <Description>a privacy-respecting, hackable metasearch engine</Description>
5
   <InputEncoding>UTF-8</InputEncoding>
5
   <InputEncoding>UTF-8</InputEncoding>
6
-  <Image>{{ host }}{{ url_for('static', filename='img/favicon.png') | replace("/", "", 1) }}</Image>
6
+  <Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image>
7
   <LongName>searx metasearch</LongName>
7
   <LongName>searx metasearch</LongName>
8
   {% if opensearch_method == 'get' %}
8
   {% if opensearch_method == 'get' %}
9
     <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>
9
     <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>

+ 1
- 1
searx/templates/oscar/opensearch.xml Parādīt failu

3
   <ShortName>{{ instance_name }}</ShortName>
3
   <ShortName>{{ instance_name }}</ShortName>
4
   <Description>a privacy-respecting, hackable metasearch engine</Description>
4
   <Description>a privacy-respecting, hackable metasearch engine</Description>
5
   <InputEncoding>UTF-8</InputEncoding>
5
   <InputEncoding>UTF-8</InputEncoding>
6
-  <Image>{{ host }}{{ url_for('static', filename='img/favicon.png') | replace("/", "", 1) }}</Image>
6
+  <Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image>
7
   <LongName>searx metasearch</LongName>
7
   <LongName>searx metasearch</LongName>
8
   {% if opensearch_method == 'get' %}
8
   {% if opensearch_method == 'get' %}
9
     <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>
9
     <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>

+ 2
- 1
searx/webapp.py Parādīt failu

749
 
749
 
750
     ret = render('opensearch.xml',
750
     ret = render('opensearch.xml',
751
                  opensearch_method=method,
751
                  opensearch_method=method,
752
-                 host=get_base_url())
752
+                 host=get_base_url(),
753
+                 urljoin=urljoin)
753
 
754
 
754
     resp = Response(response=ret,
755
     resp = Response(response=ret,
755
                     status=200,
756
                     status=200,