[fix] opensearch on chromium for android (#2132)

This commit is contained in:
Émilien Devos 2020-08-18 19:29:58 +03:00 committed by GitHub
parent 27d74826f1
commit a5e6423c39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -6,7 +6,7 @@
<Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image> <Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image>
<LongName>searx metasearch</LongName> <LongName>searx metasearch</LongName>
{% if opensearch_method == 'get' %} {% if opensearch_method == 'get' %}
<Url rel="results" type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/> <Url rel="results" type="text/html" method="get" template="{{ host }}?q={searchTerms}"/>
{% else %} {% else %}
<Url rel="results" type="text/html" method="post" template="{{ host }}"> <Url rel="results" type="text/html" method="post" template="{{ host }}">
<Param name="q" value="{searchTerms}" /> <Param name="q" value="{searchTerms}" />

View File

@ -463,6 +463,9 @@ def pre_request():
request.errors = [] request.errors = []
preferences = Preferences(themes, list(categories.keys()), engines, plugins) preferences = Preferences(themes, list(categories.keys()), engines, plugins)
user_agent = request.headers.get('User-Agent', '').lower()
if 'webkit' in user_agent and 'android' in user_agent:
preferences.key_value_settings['method'].value = 'GET'
request.preferences = preferences request.preferences = preferences
try: try:
preferences.parse_dict(request.cookies) preferences.parse_dict(request.cookies)