From a519de90af39fb3825b4699cda70155f421ddfc8 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Wed, 18 Nov 2020 10:31:19 -0500 Subject: [PATCH] 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. --- app/routes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/routes.py b/app/routes.py index d205283..90b525a 100644 --- a/app/routes.py +++ b/app/routes.py @@ -126,10 +126,12 @@ def opensearch(): if opensearch_url.endswith('/'): opensearch_url = opensearch_url[:-1] + get_only = g.user_config.get_only or 'Chrome' in request.headers.get('User-Agent') + return render_template( 'opensearch.xml', 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"'}