add OpenSearch capabilities for Chrome omnibar search
This commit is contained in:
parent
04fbaa8890
commit
68fa29a36e
3 changed files with 21 additions and 0 deletions
|
@ -83,6 +83,16 @@ def not_found_error_display(e = None):
|
|||
resp.status_code = 404
|
||||
return resp
|
||||
|
||||
@web.route('/opensearch.xml')
|
||||
def opensearch():
|
||||
template = render_template('opensearch.xml',
|
||||
baseurl=get_app_url(),
|
||||
registry_title=app.config.get('REGISTRY_TITLE', 'Quay'))
|
||||
resp = make_response(template)
|
||||
resp.headers['Content-Type'] = 'application/xml'
|
||||
return resp
|
||||
|
||||
|
||||
@web.route('/organization/<path:path>', methods=['GET'])
|
||||
@web.route('/organization/<path:path>/', methods=['GET'])
|
||||
@no_cache
|
||||
|
|
|
@ -131,6 +131,8 @@ b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
|
|||
mixpanel.init("{{ mixpanel_key }}", { track_pageview : false, debug: {{ is_debug }} });</script><!-- end Mixpanel -->
|
||||
{% endif %}
|
||||
|
||||
<link rel="search" type="application/opensearchdescription+xml" title="{{ config_set['REGISTRY_TITLE'] }}" href="/opensearch.xml" />
|
||||
|
||||
</head>
|
||||
<body ng-class="pageClass + ' ' + (user.anonymous ? 'anon' : 'signedin')" class="co-img-bg-network">
|
||||
<div id="co-l-footer-wrapper">
|
||||
|
|
9
templates/opensearch.xml
Normal file
9
templates/opensearch.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
|
||||
<ShortName>{{ registry_title }}</ShortName>
|
||||
<Description>Find public container repositories on {{ registry_title }}</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<AdultContent>false</AdultContent>
|
||||
<Language>en-us</Language>
|
||||
<Image width="16" height="16" type="image/x-icon">//static/img/quay_favicon.png</Image>
|
||||
<Url type="text/html" method="get" template="{{ baseurl }}/search?q={searchTerms}"/>
|
||||
</OpenSearchDescription>
|
Reference in a new issue