Enforce GET-only in opensearch for Chrome

The resolution for enabling full support for search + suggestions in
Chrome is to remove the "method" tag altogether for any Chrome based
browser. Any inclusion of this tag seems to break the search suggestion
feature, and makes the user add the search engine manually.
main
Ben Busby 2020-11-18 10:31:19 -05:00
parent 72cbc342af
commit a519de90af
No known key found for this signature in database
GPG Key ID: 3B08611DF6E62ED2
1 changed files with 3 additions and 1 deletions

View File

@ -126,10 +126,12 @@ def opensearch():
if opensearch_url.endswith('/'): if opensearch_url.endswith('/'):
opensearch_url = opensearch_url[:-1] opensearch_url = opensearch_url[:-1]
get_only = g.user_config.get_only or 'Chrome' in request.headers.get('User-Agent')
return render_template( return render_template(
'opensearch.xml', 'opensearch.xml',
main_url=opensearch_url, main_url=opensearch_url,
request_type='' if g.user_config.get_only else 'method="post"' request_type='' if get_only else 'method="post"'
), 200, {'Content-Disposition': 'attachment; filename="opensearch.xml"'} ), 200, {'Content-Disposition': 'attachment; filename="opensearch.xml"'}