Merge pull request #21 from alecmerdler/opensearch

OpenSearch
This commit is contained in:
Alec Merdler 2019-11-20 14:14:51 -05:00 committed by GitHub
commit 73bab07baf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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
View 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>