Add iframe-able search page for insertion into other sites

Introduces a new html template, search.html, which provides a very basic
form for submitting search queries.

Closes #319
pull/323/head
Ben Busby 3 years ago
parent 3f1096b05d
commit d5eebe9fe5
No known key found for this signature in database
GPG Key ID: 3B08611DF6E62ED2

@ -159,6 +159,14 @@ def opensearch():
), 200, {'Content-Disposition': 'attachment; filename="opensearch.xml"'}
@app.route('/search.html', methods=['GET'])
def search_html():
search_url = g.app_location
if search_url.endswith('/'):
search_url = search_url[:-1]
return render_template('search.html', url=search_url)
@app.route('/autocomplete', methods=['GET', 'POST'])
def autocomplete():
q = g.request_params.get('q')

@ -0,0 +1,13 @@
<form id="search-form" action="{{ url }}/search" method="post">
<input
type="text"
name="q"
style="width: 90%;"
autofocus="autofocus"
autocapitalize="none"
spellcheck="false"
autocorrect="off"
placeholder="Whoogle Search"
autocomplete="off">
<input type="submit" style="width: 9%" id="search-submit" value="Search">
</form>
Loading…
Cancel
Save